Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker pull “unexpected EOF”

I faced an issue with docker. The scenario is like this: we use Codebuild+Packer+docker to create AMI, which is used in deploy. During this step we pull image from artifactory and all pass fine except pulling one of the layers which is > 1Gb. After several retries it fails with error: Download failed, retrying: unknown blob and then “unexpected EOF”. Have you ever faced such issue? Any comments or advices are highly appreciated.

like image 499
Natalia Pakhol Avatar asked Dec 07 '18 22:12

Natalia Pakhol


2 Answers

This was mainly because of weak network ( as I was using mobile hotspot )

configured the docker daemon to reduce the tcp packets

$ dockerd --max-concurrent-downloads <int>  

here <int> suggests the number of docker pull layers you want to download concurrently.
default is 3

in mycase i had set to 2

$ dockerd --max-concurrent-downloads 2 &>/dev/null  

downside of doing this is sacrificing your precious time :)
takes time like hell

like image 160
Abhishek D K Avatar answered Sep 28 '22 16:09

Abhishek D K


I had this problem with a very small layer that was corrupted or broken in the registry V2 for some unknown reason. docker pull failed with "unexpected EOF" after retrying the layer (identified as "1f8fd317c5a4" in this case).

Rebuilding the image from source and trying to docker push said "layer already exists", not fixing the issue.

I was able to delete the offending layer using curl like so;

curl -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' -sk "https://registry.local/v2/image-name/manifests/1033-develop-7e414712"

(substitute your registry for "registry.local", your image name for "image-name", and your image tag or "latest" for "1033-develop-7e414712".)

Get the complete sha256 digest for layer 1f8fd317c5a4 from the JSON output, and use it in next command:

curl -k -X DELETE "https://registry.local/v2/image-name/blobs/sha256:1f8fd317c5a406a75130dacddc02bd09a9abf44e068e2730dd8f5238666bb390"

Now you will be able to docker push registry.local/image-name:1033-develop-7e414712 to upload the layer you deleted, and everything works.

like image 24
retrospectacus Avatar answered Sep 28 '22 16:09

retrospectacus