Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying with docker push is slow because there are many images

I'm trying to deploy via docker. I'm using the following workflow:

  1. Build locally
  2. Push my image to docker hub
  3. On the server: pull the image
  4. 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?

like image 354
Sean Clark Hess Avatar asked Apr 24 '15 16:04

Sean Clark Hess


People also ask

Why does docker push so slowly?

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.

Does docker push compress?

Progress bars are shown during docker push, which show the uncompressed size. The actual amount of data that's pushed will be compressed before sending, so the uploaded size will not be reflected by the progress bar.

Can docker pull multiple images?

By default, docker pull pulls a single image from the registry. A repository can contain multiple images. To pull all images from a repository, provide the -a (or --all-tags ) option when using docker pull .


2 Answers

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:

https://forums.aws.amazon.com/thread.jspa?threadID=222834

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.

like image 82
ajl Avatar answered Sep 20 '22 15:09

ajl


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

https://github.com/docker/docker-registry

While pushing still takes time on new images, pulls are very fast, as all layers are in the redis cache.

like image 32
seanmcl Avatar answered Sep 23 '22 15:09

seanmcl