qdqht00 2020-07-26
## 编辑文件vim /etc/docker/daemon.json## 将以下内容复制到文件中 { "registry-mirrors": ["https://registry.docker-cn.com"] } 重启Docker systemctl restart docker
## 编辑文件vi /etc/resolv.conf ## 将以下内容复制到文件中 nameserver 8.8.8.8 nameserver 8.8.8.4
## centossystemctl restart network ## mac ifconfig en0 down ifconfig en0 up
## 找到可用的IP地址,输入以下命令:dig @114.114.114.114 registry-1.docker.io ## 出现如下: J-pro:~ will$ dig @114.114.114.114 registry-1.docker.io ; <<>> DiG 9.10.6 <<>> @114.114.114.114 registry-1.docker.io ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 13913 ;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION SECTION: ;registry-1.docker.io. IN A ;; ANSWER SECTION: registry-1.docker.io. 41 IN A 52.54.232.21 registry-1.docker.io. 41 IN A 52.72.232.213 registry-1.docker.io. 41 IN A 18.232.227.119 registry-1.docker.io. 41 IN A 34.195.246.183 registry-1.docker.io. 41 IN A 3.223.220.229 registry-1.docker.io. 41 IN A 3.224.175.179 registry-1.docker.io. 41 IN A 3.94.35.164 registry-1.docker.io. 41 IN A 52.4.20.24 ;; Query time: 99 msec ;; SERVER: 114.114.114.114#53(114.114.114.114) ;; WHEN: Sun Jul 26 11:22:46 CST 2020 ;; MSG SIZE rcvd: 177 将上述IP找任意找一个输入到hosts中 ## 编辑hosts文件vi /etc/hosts ## 加入上述找到的可用IP地址 52.87.94.70 registry-1.docker.io ## 刷新hosts source /etc/hosts
> 打开Charles软件,选中 macOs Proxy。再试试看,很有可能是代理的问题导致的网络连接不可用,甚至可能其他软件也联网不了。