为什么 Docker 构建命令在 Elastic Beanstalk 中运行如此缓慢? [英] Why are Docker build commands running so slow in Elastic Beanstalk?

查看:39
本文介绍了为什么 Docker 构建命令在 Elastic Beanstalk 中运行如此缓慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

EB 抱怨我的构建超时,所以我 SSH 进入一个实例并决定自己运行 docker build 以查看发生了什么.每一步,即使是像 mkdir 这样简单的东西,都需要很长时间才能运行.甚至 WORKDIR 在执行前至少会停顿一两分钟.

EB was complaining that my build was timing out, so I ssh'd into an instance and decided to run docker build myself to see what was happening. Every step, even something as simple as a mkdir takes ages to run. Even a WORKDIR stalls for at least a minute or two before executing.

在我的本地机器上,这些是即时的.这是怎么回事?

On my local machine these are instant. What is going on?

推荐答案

在 AWS 上运行的 Ubuntu 机器也存在同样的问题.原来解决方案的关键是从 devicemapper 切换到 aufs 存储后端.

Same issue here with an Ubuntu machine running on AWS. Turns out the the key to the solution was switching from devicemapper to aufs storage backend.

首先,运行以下命令找出您当前使用的存储后端:

First, run the following command to figure out which storage backend your currently use:

docker 信息 |grep 存储

如果它显示 devicemapper,您可能找到了缓慢的原因.

If it says devicemapper, you probably found the reason for the slowness.

这是在 Ubuntu 中切换到 aufs 后端的程序,取自 此处:

Here is the prodecure for switching to the aufs backend in Ubuntu, taken from here:

  1. sudo apt-get install -y -q linux-image-extra-$(uname -r)
  2. sudo service docker restart

请注意,您必须重建所有现有的图像/容器,因为它们会在您切换到 aufs 时被擦除.

Note that you will have to rebuild all your existing images / containers, as they will be wiped when you switch to aufs.

这篇关于为什么 Docker 构建命令在 Elastic Beanstalk 中运行如此缓慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆