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