发布于 4年前

Docker拉取镜像失败报错Error response from daemon: Get https://registry-1.docker.io解决办法

我们docker安装mysql拉取镜像docker pull mysql:5.7 时报以下错误:

[root@localhost ~]# docker pull mysql:5.7      
Error response from daemon: Get https://registry-1.docker.io/v2/library/mysql/manifests/5.7: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fmysql%3Apull&service=registry.docker.io: net/http: TLS handshake timeout

<span style="color:#f33b45;">Error response from daemon: Get https://registry-1.docker.io/v2/library/mysql/manifests/5.7: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fmysql%3Apull&service=registry.docker.io: net/http: TLS handshake timeout</span>

解决方案:

1、打开终端,su root 输入密码。
2、打开 vim /etc/docker/daemon.json(若没有自行创建)
3、写入以下内容:

{
    "registry-mirrors":["https://docker.mirrors.ustc.edu.cn"]
}

可用的镜像地址很多,在这里推荐https://docker.mirrors.ustc.edu.cn这个镜像仓库。
4、重启一下docker:

systemctl daemon-reload 
systemctl restart docker

重启docker之后再执行docker pull mysql:5.7,成功!

©2020 edoou.com   京ICP备16001874号-3