解决docker报Error response from daemon: Get "https://registry-1.docker.io/v2/"错误
报错详情
首先先看一下问题报错效果,我想要拉去nacos-serve:1.1.4的镜像,报如下错误,从报错信息可以看到,用于网络的愿意,导致客户端连接超时
[root@localhost ~]# docker run --name nacos -e MODE=standalone -p 8848:8848 -d nacos/nacos-server:1.1.4
Unable to find image 'nacos/nacos-server:1.1.4' 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'.
具体解决方法如下:
1.备份原来的配置文件
cp /etc/docker/daemon.json{,.bak}
2.删除或修改daemon.json 文件,我这里因为是测试环境就直接删除原来的配置文件了,并添加如下配置
rm -rf /etc/docker/daemon.json sudo tee /etc/docker/daemon.json <<-'EOF'
> {
> "registry-mirrors": [
> "https://docker.1ms.run",
> "https://docker.1panel.live/"
> ]
> }
> EOF
3.重新加载配置文件和重启docker
sudo systemctl daemon-reloadsudo systemctl restart docker
4.再次拉取进行进行测试
[root@localhost ~]# docker run --name nacos -e MODE=standalone -p 8848:8848 -d nacos/nacos-server:1.1.4
Unable to find image 'nacos/nacos-server:1.1.4' locally
1.1.4: Pulling from nacos/nacos-server
5ad559c5ae16: Pull complete
6e9cb123f3e1: Pull complete
035a01617e57: Pull complete
f06623a3ec58: Pull complete
2a36a33e88d6: Pull complete
403a1ab0a74b: Pull complete
12d67041a133: Pull complete
c1010ab56ac6: Pull complete
Digest: sha256:9d8d7be3bbadeb96b4796319b8c70e544b86f398a825a8fb2bffb7625dbbc20d
Status: Downloaded newer image for nacos/nacos-server:1.1.4
1001fd145caef6f4ac5c46b735a120dd0135523cfa43db666e0b3b5ae43a15e0
[root@localhost ~]#