问题出现的场景是在CentOS下安装Docker完成后 运行命令
docker run hello-world
后提示Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Head "https://registry-1.docker.io/v2/library/hello-world/manifests/latest": Get "https://auth.docker.io/token?scope=repository%3Alibrary%2Fhello-world%3Apull&service=registry.docker.io": net/http: TLS handshake timeout.
解决方案:
切换国内阿里云镜像,创建daemon.json文件
vim /etc/docker/daemon.json
文件中添加内容如下:
{
"registry-mirrors": ["https://alzgoonw.mirror.aliyuncs.com"]
}
保存并退出 重启docker服务
systemctl restart docker
systemctl status docker
再次运行docker
docker run hello-world
提示:
hello world运行成功