Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to push single docker image layers at time?

Tags:

docker

I just want to point out: My internet connection sucks. So I've started pushing a new image, the scenario is something like this:

b57ecdb750f2: Pushing [====>                                              ]  43.57MB/473.9MB
9b7e4da6c261: Pushing [==================================================>]  18.94kB
21d523b40367: Pushed 
e18c77c6a7b1: Pushing [==================>                                ]  106.9MB/285.9MB
5ee5be8f332e: Pushed 
78a99e283d45: Retrying in 1 second 
98b9d6eacb01: Pushing [=========================================>         ]  95.06MB/114MB
96e14acce2fd: Retrying in 1 second 
787c930753b4: Pushing [==================================================>]  318.3MB/318.3MB
9f17712cba0b: Pushing [=======================>                           ]   56.9MB/122.6MB
223c0d04a137: Pushing [==================================================>]  45.18MB
fe4c16cbf7a4: Preparing 

All those layers being pushed at the same time are simply killing my internet connection, not allowing me to navigate and docker boycotting itself as many of those layers are uploaded with errors and restarting again and again.
Is there a way to upload a single layer at time? (BTW, no, change my ISP or my crappy router is not an option)

like image 553
Alter Lagos Avatar asked Jul 06 '17 02:07

Alter Lagos


People also ask

Does docker push push all layers?

Concurrent uploadsBy default the Docker daemon will push five layers of an image at a time. If you are on a low bandwidth connection this may cause timeout issues and you may want to lower this via the --max-concurrent-uploads daemon option.

How do I push a docker image to a specific repository?

To push an image to Docker Hub, you must first name your local image using your Docker Hub username and the repository name that you created through Docker Hub on the web. You can add multiple images to a repository by adding a specific :<tag> to them (for example docs/base:testing ).

Why is docker push so slow?

deployment - Deploying with docker push is slow because there are many images - Stack Overflow.

Are docker layers compressed?

docker images are compressed by default. you will notice when running docker pull , where it will download the needed images\layers and then extract\decompress them. there is no need for you to compress the files within your docker images.


2 Answers

In my Ubuntu, I added /etc/docker/daemon.json with:

{
  "max-concurrent-uploads": 1
}

and then sudo service docker restart. Worked like a charm.

like image 185
Alter Lagos Avatar answered Oct 19 '22 12:10

Alter Lagos


As of this writing (on macOS), if you have the docker daemon running, open Preferences -> Daemon -> Advanced and include the json-like config: ... "max-concurrent-uploads": 1 Making sure your json syntax is correct then click Apply & Restart

Then subsequent docker pushes will only try to push one layer at a time

enter image description here

like image 11
warren Avatar answered Oct 19 '22 11:10

warren