SoFunction
Updated on 2025-03-09

How to modify the number of concurrent threads uploaded/downloaded by Docke to solve the error problem of docker: unexpected EOF.

When downloading or uploading the image, it is possible that the error of docker: unexpected EOF. may be reported due to network problems. At this time, you can consider solving it by modifying the number of upload/download concurrent threads.

Method 1: Modify the configuration file

sudo vim /etc/docker/

This is an example (one is to modify the upload number, and the other is to modify the download number. Add it as needed. If you do not add it, it is the default value. See Method 2 for viewing the default value)

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

Because I have no problem uploading, and downloading will encounter an EOF error, so I only add the sentence "max-concurrent-downloads":1, which is my configuration file (there is runtimes because nvidia-docker is installed)

{
    "runtimes": {
        "nvidia": {
            "path": "nvidia-container-runtime",
            "runtimeArgs": []
        }
    },
    "max-concurrent-downloads": 1
}

Next restart docker

sudo systemctl daemon-reload && sudo systemctl restart docker

This successfully modified

Method 2: Use the dockerd command to modify parameters

This method is suitable for manually starting docker daemon and debugging. If it is used normally and has no special requirements, the method will be more convenient and more suitable.

Enter the command to view the parameters supported by dockerd

dockerd --help

You can find the default download number is 3 and the upload number is 5 in the output

--max-concurrent-downloads int            Set the max concurrent downloads for each pull (default 3)
--max-concurrent-uploads int              Set the max concurrent uploads for each push (default 5)

Stop the original docker service first

sudo systemctl stop docker

Docker socket can be stopped or not

sudo systemctl stop 

Now modify the number of downloads

dockerd --max-concurrent-downloads 1

After running, do not press ctrl+c to stop, because after stopping, it means that docker has stopped. Therefore, you must run the docker pull download image in a new window, and you will see that only one layer is downloaded at a time when downloading.

This is the article about modifying the number of concurrent threads uploaded/downloaded by Docke (solving docker: unexpected EOF.). For more related content on uploading and downloading of concurrent threads, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!