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?
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.
Elastic Beanstalk supports the deployment of web applications from Docker containers. With Docker containers, you can define your own runtime environment.
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:
sudo apt-get install -y -q linux-image-extra-$(uname -r)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With