Cannot download Docker image from repository

2020-06-01 07:51发布

I am trying to create a swarm setup on my laptop. I am running swarm daemon on laptop, and running 2 Ubuntu 14.04 VM as docker node. On one of the nodes I am able to run swarm and I can connect to swarm daemon. I can list the node with docker info and spawn a container on it. But when I try to pull swarm image on another VM node, I get the following error:

pensu@pensu-virtual-machine:~$ sudo docker pull swarm
Pulling repository swarm
FATA[0025] Get https://index.docker.io/v1/repositories/library/swarm/images: dial tcp: lookup index.docker.io on 127.0.1.1:53: read udp 127.0.1.1:53: i/o timeout 

I checked and someone said it's a proxy issue. But I am not using any proxy server. Here are other relevant information:

pensu@pensu-virtual-machine:~$ sudo docker version
Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): linux/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

Here is my /etc/default/docker:

pensu@pensu-virtual-machine:~$ cat /etc/default/docker 
# Docker Upstart and SysVinit configuration file

# Customize location of Docker binary (especially for development testing).
#DOCKER="/usr/local/bin/docker"

# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"

# If you need Docker to use an HTTP proxy, it can also be specified here.
#export http_proxy="http://127.0.0.1:3128/"

# This is also a handy place to tweak where Docker's temporary files go.
#export TMPDIR="/mnt/bigdrive/docker-tmp"

Any idea about what am I doing wrong?

Update: This is something different. I was trying this all from home. Today morning I came to office, logged in and voila, I was able to pull the image!

Not sure what is the reason, but looks like I will need to come to office to pull docker images!

6条回答
疯言疯语
2楼-- · 2020-06-01 08:11

I had the same issue, my solution for this is, run following commands.

boot2docker stop 
boot2docker delete
boot2docker init
boot2docker up

This basically delete the vm image use by boot2docker and start over. This won't delete your local images.Then execute docker pull command.

查看更多
来,给爷笑一个
3楼-- · 2020-06-01 08:12

Just stop and restart your docker host:

boot2docker stop
boot2docker start

Credits to: https://forums.docker.com/t/pulling-docker-images-i-o-timeout/740/6

查看更多
smile是对你的礼貌
4楼-- · 2020-06-01 08:13

I tried all the solutions that are stated but they didn't help. What fixed the problem for me is the tip posted here,

docker-machine sssh
echo "nameserver 8.8.8.8" > /etc/resolv.conf
exit
查看更多
【Aperson】
5楼-- · 2020-06-01 08:16

Updated for modern times:

docker-machine stop default
docker-machine start default

(docker-machine restart default doesn't fix it).

查看更多
冷血范
6楼-- · 2020-06-01 08:16

This error message:

  • lookup index.docker.io on 127.0.1.1:53: read udp 127.0.1.1:53: i/o timeout

tells that connection to local dns server (127.0.1.1:53) ends with timeout.

I guess this issue is connected with network/dns configuration on virtual machine.

查看更多
倾城 Initia
7楼-- · 2020-06-01 08:21

When this happened to me, it turned out the image had already been downloaded before, but it was defect due to a problem during the earlier download.

I'm not sure why this lead to the above error message, but after removing the image, it downloaded without problems.

So to fix it:

docker image ls

Note the id of the problem image, then

docker image rm <id>

Then re-download

docker pull <image-name>
查看更多
登录 后发表回答