Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are Docker build commands running so slow in Elastic Beanstalk?

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?

like image 333
Kevin Wang Avatar asked Sep 21 '14 20:09

Kevin Wang


People also ask

How do I speed up Docker build time?

The easiest way to increase the speed of your Docker image build is by specifying a cached image that can be used for subsequent builds. You can specify the cached image by adding the --cache-from argument in your build config file, which will instruct Docker to build using that image as a cache source.

Does Elastic Beanstalk support Docker?

Elastic Beanstalk supports the deployment of web applications from Docker containers. With Docker containers, you can define your own runtime environment.


1 Answers

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 info | grep Storage

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

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

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

like image 148
urish Avatar answered Sep 21 '22 00:09

urish