[root@localhost docker]# docker info
Containers: 1
 Running: 1
 Paused: 0
 Stopped: 0
Images: 2
Server Version: 17.09.0-ce
Storage Driver: vfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 3.10.0-123.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 979.9MiB
Name: localhost.localdomain
ID: MIWK:QOOI:QTXF:EZYC:MYB5:MEA2:GGJ2:UO3O:BFKY:CUNV:FPQF:HJPB
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: zk2011415107
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 192.168.1.30:5000
 127.0.0.0/8
Registry Mirrors:
 http://5ffab16d.m.daocloud.io/
Live Restore Enabled: false

利用二进制文件安装的docker,由于配置的dns1是其它的导致无法下载镜像,报错为:

[root@localhost ~]# docker pull nginx
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

修改/etc/sysconfig/network-scripts/ifcfg-eno16777736

[root@localhost network-scripts]# more ifcfg-eno16777736
HWADDR=00:0C:29:67:09:A2
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=3ebc5054-b9b8-4230-8533-d7f866702108
ONBOOT=yes
GATEWAY=192.168.1.2
IPADDR=192.168.1.30
NETWORK=255.255.255.0
DNS1=8.8.8.8

然后执行

systemctl restart network

然后就可以正常下载镜像了

[root@localhost system]# docker pull ubuntu:12.04
12.04: Pulling from library/ubuntu
d8868e50ac4c: Downloading [==================================================>]   7.64MB/7.64MB
83251ac64627: Download complete 
589bba2f1b36: Download complete 
d62ecaceda39: Download complete 
6d93b41cfc6b: Download complete 
12.04: Pulling from library/ubuntu
d8868e50ac4c: Downloading [========>                                          ]  6.709MB/39.1MB
83251ac64627: Download complete 
589bba2f1b36: Download complete 
d8868e50ac4c: Downloading [==============>                                    ]  11.03MB/39.1MB
6d93b41cfc6b: Download complete 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐