A solution for Docker unable to pull the image

Docker is installed on Alibaba Cloud ECS. After the installation is complete, running hello-world reports that the connection to the docker warehouse times out:

#docker run hello-world

Unable to find image 'hello-world:latest' locally

Pulling repository docker.io/library/hello-world

docker: Network timed out while trying to connect to https://index.docker.io/v1/repositories/library/hello-world/images. You may want to check your internet connection or if you are behind a proxy..

See 'docker run --help'.

 

After checking several methods that are invalid, open the network card configuration file, set DNS, and solve the problem:

#vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.132.40.37
NETMASK=255.255.240.0

DNS1=8.8.8.8 #google's DNS
DNS2=114.114.114.114 #Telecom's DNS
~

 

# service network restart

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326679874&siteId=291194637