Docker pull “unexpected EOF” - docker

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.

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

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.

With Docker Desktop on Windows, could not find the dockerd command, then added the below entry in the daemon.json file and restarted the docker service.
"max-concurrent-downloads": 1
You will find this file at path- C:\Users\<user-name>\.docker\daemon.json.
This will pull the layers in a sequential manner hence it will take time, but yes, this is an alternative solution to download the large image file over the weak network connection.

Had the same issue due to a bad connection. In the documentation, here is the dockerd command.
For Linux, simply add:
$ dockerd --max-concurrent-downloads 2
$ dockerd --max-download-attempts 10
For windows docker desktop, open settings -> Docker Engine and pop the following in with the numbers best for you. You can see all the options in the docs as above.

Stop docker service: sudo service docker stop
Run docker service with decreasing max-concurrent-downloads to what suits your internet bandwidth (Unfortunately 1 for me) and increasing max-download-attempts: sudo dockerd --max-concurrent-downloads 1 --max-download-attempts 10
PS: I am not a docker expert. But, I believe there is a better way to do it by adding some config whether to the registry or your docker client.

Problem: Unable to pull docker image its giving retrying to pull image and EOF
Solution: Update docker software then try to pull image it resolves the issue.

This does not match the situation described by OP perfectly, but I'll post it here for future reference. Docker Desktop 4.15.0 introduced a bug which caused a similar issue for me. Depending on the Docker Desktop version and command used, one of these errors would pop up:
% docker pull alpine:3.7
Error response from daemon: Get "https://registry-1.docker.io/v2/": read tcp 192.168.65.4:55694->192.168.65.5:3128: read: connection reset by peer
% docker-compose up --build
// Some stuff
=> ERROR [container_name internal] load metadata for docker.io/library/alpine:3.7 0.0s
------
> [container_name internal] load metadata for docker.io/library/alpine:3.7:
------
failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to do request: Head "https://registry-1.docker.io/v2/library/alpine/manifests/3.7": unexpected EOF
% docker pull alpine:3.7
Error response from daemon: Get "https://registry-1.docker.io/v2/": unexpected EOF
The solution was to uninstall Docker Desktop and install an older version. I'm posting this here since a lot of guides and instructions recommend updating Docker Desktop to its newest version, but in my case that is exactly what caused the issue. Of course this bug will most likely be patched in a newer version at some point, I have notified Docker support about it.
Edit: It seems that there is a GitHub topic for my issue.

Related

install elastic search in docker

I used these two commands in cmd:
docker pull elasticsearch
show error:
Using default tag: latest
Error response from daemon: manifest for elasticsearch:latest not found: manifest unknown: manifest unknown
and this command with several different versions:
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.9.0
show error:
Error response from daemon: Get https://docker.elastic.co/v2/elasticsearch/elasticsearch/manifests/7.9.0: Get https://docker-auth.elastic.co/auth?scope=repository%3Aelasticsearch%2Felasticsearch%3Apull&service=token-service: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
how to resolve this problem?
please guide me.
latest version of elastic search does not work out of the box
https://github.com/elastic/elasticsearch-docker/issues/215
so, use specific version to install
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.11.1
Looking at your error message, while pulling the docker image, it seems that your network is blocking you to access the public docker repo to fetch the image.
request canceled while waiting for connection (Client.Timeout
exceeded while awaiting headers)
By any chance are you behind a VPN or firewall or having some restricition on public network/docker registry access?
docker run elasticsearch:{version} -d
use version, which you want to install
example -> docker run elasticsearch:8.4.3 -d
can other images be pulled?
Have you made any modifications to the docker default registry like adding new local registries to this file
/etc/containers/registries.conf
https://www.docker.com/blog/how-to-use-your-own-registry/
and also please check with the port rules for port 5000.
check your firewall, might likely be the culprit.
had the same issue running a compose file trying to pull image from image: docker.elastic.co/elasticsearch/elasticsearch:${VERSION} i modified it to image: elasticsearch:${VERSION} and it worked. i.e. removing the docker.elastic.co/elastisearch part of the original url

SMTP4DEV - Docker pull error - Why get I Unkown Blob

When trying to get (pull or run) the docker smtp4dev, I've got the following error message : /usr/bin/docker-current: unknown blob.
I'm trying to run it from :
a CentOS VM,
with Docker version 1.13.1, build cccb291/1.13.1
Please find hereafter my terminal output
sudo docker run --rm -p 3001:80 -p 2525:25 rnwood/smtp4dev:3.1.0-ci2020052101
Unable to find image 'rnwood/smtp4dev:3.1.0-ci2020052101' locally
Trying to pull repository rnwood/smtp4dev ...
3.1.0-ci2020052101: Pulling from rnwood/smtp4dev
68ced04f60ab: Downloading [=======> ] 3.898 MB/27.09 MB
4ddb1a571238: Downloading [===========> ] 3.784 MB/17.06 MB
94b78a0446e2: Download complete
b48f8e1b0b06: Downloading
a41ea3d79519: Waiting
7064c9d40b9c: Waiting
/usr/bin/docker-current: unknown blob.
See '/usr/bin/docker-current run --help'.
Thanks by advance for your support.
Following the new update of SMTP4DEV...it seems now working.. no root cause found...
The best hypothesis : problem with proxy network which leads to fail the build of the docker...
Stay tuned...

Minikube external registry Failed to pull image redis-ha

Working on getting development environment setup in Minikube and ran across an issue pulling images from the https://quay.io/v2/ registry.
I have ran the command:
eval $(minikube docker-env) .
Which allows me to build my local Dockerfile in Minikube and it does a great job with that and deployments work great with local images.
I then used helm to install
helm install stable/mssql-linux .
Which worked fine and its image points to this microsoft/mssql-server-linux:2017-CU3 HERE
I am also working with redis-ha and installed like so:
helm install stable/redis-ha --set="rbac.create=false"
The rbac.create=false seems to allow it to install in Minikube without causing all sorts of issues. However, despite creating deployments and services...the deployments ultimately fail because it cant pull the image.
I get the following error:
Failed to pull image "quay.io/smile/redis:4.0.8r0": rpc error: code = Unknown desc = Error response from daemon: Get https://quay.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
The deployments point to this registry image: quay.io/smile/redis:4.0.8r0
I have changed my DNS pretty much everywhere I could to point to 8.8.8.8 as it seems like it cant resolve the URL. It could also just be that I need to add the registry someplace? I kind of feel that its registry specific since Minikube docker daemon appears to be able to pull from docker hub but not quay.io.
If I use a terminal that is not running eval $(minikube docker-env) and use the docker daemon on my host computer I can pull the quay.io/smile/redis:4.0.8r0 image just fine...ssh into minikube and try and it cant pull.
Minikube version
minikube version: v0.25.0
Docker for Mac
Version 17.12.0-ce-mac55 (23011)
as it seems like it cant resolve the URL
What lead you to believe that, when the error clearly states that it has a Client.Timeout exceeded while awaiting headers? It resolved the registry to an IP address, and even apparently opened a network connection to what it thinks is the registry's IP and port. But after that, the networking stack in minikube did not, in fact, allow the traffic out. Observe that the error wasn't DNS, and it wasn't connection refused, it was connection timed out. That is almost always a firewall-esque behavior.
That smells very, very much like a corporate HTTP proxy, since your machine can interact with the Internet but minikube cannot.
There are a ton of troubleshooting steps one could go through, however, if you are interested in a very quick win, you can, from your working host computer, run docker save quay.io/smile/redis:4.0.8r0 | ssh-into-minikube "docker load" and treat minikube as if it were airgapped.
I dont know what the underlying reason was...perhaps Minikube just being fragile but ended up:
Removing minikube
rm -rf ~/.minikube
Running start again
minikube start --vm-driver=hyperkit
Reran init helm init
Now everything is pulling as it should....

Unable to pull docker image, getting 'remote error: access denied'

I'm trying to check the installation docker pull hello-world
But getting the following error:
Pulling repository hello-world
Get https://index.docker.io/v1/repositories/library/hello-world/images: remote error: access denied
I have CentOS 6.5
Docker version 1.7.1, build 786b29d/1.7.1
I'm in a corporate network but curl https://index.docker.io/v1/repositories/library/hello-world/images forks fine.
What might be the issue?
Thanks in advance!
I got this error while I was trying to pull mongodb image instead of mongo.
So make sure image name is correct. The very same error message happens on both run and pull commands.
Had the same problem & error on the host working via proxy.
In essence - if you are behind an HTTP proxy server, you will need to add proxy configuration in the Docker systemd service file.
https://docs.docker.com/engine/admin/systemd/
(See at "HTTP proxy" section).
This helped me.
Did you add your user in docker group
https://docs.docker.com/engine/installation/linux/centos/#/create-a-docker-group
Otherwise, you should execute docker command with sudo before
docker pull hello-world

Docker: how to fix "Layer already being pulled by another client. Waiting"

I have a fresh install using boot2docker. (DockerToolbox was giving me the same error. After uninstalling DockerToolbox, I deleted ~/.docker and searched my whole filesystem for anything starting with "docker" and found no other configuration files where things might be hiding.)
This is the second command I did, after docker run hello-world:
bash-3.2$ docker run -it ubuntu /bin/bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
6071b4945dcf: Verifying Checksum
5bff21ba5409: Pulling fs layer
e5855facec0b: Download complete
8251da35e7a7: Download complete
8251da35e7a7: Layer already being pulled by another client. Waiting.
And I'm stuck here indefinitely.
I promise I only have 1 docker process running. I just want to get past this. If it means nuking whatever cache is in place and doing a manual download, that's okay. I just want to stop being stuck here for hours.
You need to restart Docker service or just restart the OS.
Also in this issue #avramirez pointed out that you can do this using boot2docker:
boot2docker stop
boot2docker up
docker pull <repo>
quote from issue#15603 message:
Hello all! I believe this should by fixed on master by #15489 (and
will soon ship in a few weeks as part of Docker 1.9.0).
This is a bug in Docker.
Try out the following in order (Trying to avoid restarting the OS):
ps aux | grep docker-compose and find the PID of docker-compose processes running.
Kill them using kill <pid>
Restart Docker using service docker restart (linux)
2nd method should ideally solve the problem, if not, Restart the OS.
Hopefully, this issue will be solved in version 1.9

Resources