CentOS 7 下 Docker Pull TLS handshake timeout 错误

Docker 安装方式

拉取 yum 源
[root@node1 ~]# curl http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -o /etc/yum.repos.d/docker.repo
yum 安装
[root@node1 ~]# yum -y install docker-ce-3:19.03.9-3.el7.x86_64

错误

[root@node1 yum.repos.d]# docker pull postgres:latest
Error response from daemon: Get https://registry-1.docker.io/v2/library/postgres/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fpostgres%3Apull&service=registry.docker.io: net/http: TLS handshake timeout

解决办法

添加配置文件
[root@node1 ~]# cat /etc/docker/daemon.json 
{
 "registry-mirrors":["https://6kx4zyno.mirror.aliyuncs.com"]
}
重启 docker
[root@node1 ~]# systemctl restart docker

再次拉取

[root@node1 yum.repos.d]# docker pull postgres:latest
latest: Pulling from library/postgres
a076a628af6f: Pull complete 
d54fa0e0eb76: Pull complete 
8950a7ea6876: Pull complete 
1cc02b1df09e: Pull complete 
06f548e51228: Pull complete 
74665692d4ea: Pull complete 
235e34eb13ab: Pull complete 
4ad7ef5e2e79: Pull complete 
76670339b0f8: Pull complete 
496fa0539f99: Pull complete 
f32ecbdf3b52: Pull complete 
7536b8fe81ac: Pull complete 
71dfc17927aa: Pull complete 
fd48bac409bb: Pull complete 
Digest: sha256:ec74afc9fa969a235462c27017a3fe73a05c9d4725d7e4afbe2ba6eb82fdfc87
Status: Downloaded newer image for postgres:latest

参考

上一篇:1110 Complete Binary Tree (25 分)


下一篇:Docker常用命令