Deploying with docker push is slow because there are many images
I’m trying to deploy via docker. I’m using the following workflow:
- Build locally
- Push my image to docker hub
- On the server: pull the image
- On the server: start the image
But docker push takes FOREVER. There are like 30 images, and it has to walk through each one and say “Image already exists”. Is there any way to speed this up?
Alternatively, should I be using a different process to deploy?
3 Solutions collect form web for “Deploying with docker push is slow because there are many images”
If you’re using a local registry, we recently added a redis cache which has helped speed things up tremendously. Details about how to do this are on the registry github page
While pushing still takes time on new images, pulls are very fast, as all layers are in the redis cache.
The most likely reason why you are pushing more/large layers of your images on every deployment is that you have not optimized your Dockerfiles. Here is a nice intro http://blog.tutum.co/2014/10/22/how-to-optimize-your-dockerfile/.
If you are pushing on AWS ECR, like I was, it may be that docker on your local needs to restart. See thread about AWS ECR slowness:
This may affect other platforms as well. It seems that around 1.12.1 on Mac, anyhow, there are some slowness issues that go away with a restart of Docker.