I have a deployment setup with Docker that works as follows:
- Build an image on my dev machine via a Dockerfile
- Push the image to a registry (I tried both Docker Hub and Quay.io)
- Pull this image to the deployment server, and restart the container.
I'd like to do these steps as quickly as possible, but they take an incredibly long time. Even for an image of modest size (750MiB, including the standard ubuntu
and friends), after a small modification, it takes 17 minutes to deploy. I optimized the order of items in my Dockerfile
, so it actually hits the cached images most of the time. This doesn't seem to make a difference.
The main culprit is the docker push
step. For both Docker Hub and Quay.io, it takes an unrealistically long time to push images. In one simple benchmark I did, I executed docker push
twice back to back, so all the previous images are already on the registry. So I only see these lines:
...
bf84c1d841244f: Image already pushed, skipping
...
But if I time the push, the performance is horrendous. Pushing to Quay.io takes 3.5 minutes when all the images are already on the server! Pushing to Docker Hub takes about 12 minutes!
There is clearly something wrong somewhere, since many people are using Docker in production, these times are exactly the opposite of continuous delivery.
How can I make this run quicker? Do others also see this kind of performance? Does it have to do with the registry services, or somehow related to my local machine?
I am using Docker under Mac OS X.