How to pull layers one by one in Docker to avoid connection timeout?

Please follow the step if docker running already Ubuntu:

sudo service docker stop
sudo dockerd --max-concurrent-downloads 1

Download your images after that stop this terminal and start the daemon again as it was earlier.

sudo service docker start

The Docker daemon has a --max-concurrent-downloads option. According to the documentation, it sets the max concurrent downloads for each pull.

So you can start the daemon with dockerd --max-concurrent-downloads 1 to get the desired effect.

See the dockerd documentation for how to set daemon options on startup.


There are 2 ways:

  1. permanent change. add docker settings file:

sudo vim /etc/docker/daemon.json

the json file as below:

{ "max-concurrent-uploads": 1, "max-concurrent-downloads": 4 }

after adding the file, run sudo service docker restart

  1. temporary change

stop the docker by

sudo service docker stop

then run

sudo dockerd --max-concurrent-uploads 1

at this point, start the push at another terminal. it will transfer files one by one. when you finished, restart the service or computer.

Tags:

Docker