Docker pull “unexpected EOF”

Natalia Pakhol picture Natalia Pakhol · Dec 7, 2018 · Viewed 14.1k times · Source

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.

Answer

retrospectacus picture retrospectacus · Jun 4, 2019

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.