安裝 docker, 可以用 daocloud 的快捷安裝命令
curl -sSL https://get.daocloud.io/docker | sh
https://get.daocloud.io/#install-docker
完成安裝后,如果執(zhí)行命令 pull 鏡像時(shí)報(bào)錯(cuò)
$ docker pull ubuntu
Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 114.114.114.144:53: read udp 139.196.23.0:54820->114.114.114.144:53: i/o timeout
分析原因可能是 registry-1.docker.io 域名無法正常解析導(dǎo)致的。
解決方案:在 hosts 中添加一條 registry-1.docker.io 指定 ip
$ vim /etc/hosts
末尾添加一行
52.5.247.186 registry-1.docker.io
52.5.247.186 可能會(huì)變的,找一臺能正常訪問 https://registry-1.docker.io/v2/ 的電腦,通過抓包獲取 registry-1.docker.io 的有效 IP,改成相對應(yīng)的就行
再次 pull 鏡像,問題解決