执行一下命令时报错:
docker run hello-world
错误信息如下:
Unable to find image 'hello-world:latest' locally
docker: 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).
See 'docker run --help'.
解决方法
添加镜像加速器
sudo vim /etc/docker/daemon.json
{
"registry-mirrors": [
"此处写镜像源地址"
]
}
Docker镜像源地址
镜像名称 | 链接 |
---|---|
官方国内镜像 | https://registry.docker-cn.com |
网易 | http://hub-mirror.c.163.com |
中国科技大学 | https://docker.mirrors.ustc.edu.cn |
重新加载配置文件并重启Docker
sudo systemctl daemon-reload
sudo systemctl restart docker
校验是否存在
sudo docker info