Docker拉取images时报错Error response from daemon

docker拉取redis时,抛出以下错误:

[master@localhost ~]$ docker pull redis
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/library/redis/manifests/latest: net/http: TLS handshake timeout

以及:

[master@localhost ~]$ docker pull redis
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/library/redis/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fredis%3Apull&service=registry.docker.io: net/http: request canceled (Client.Timeout exceeded while awaiting headers)

看来是网络的问题,由于是新安装的docker,国内直接拉取docker hub上的images速度很慢,看来应该是没有配置加速的原因导致的,配置一个加速器,这里配置的是DaoCloud,使用命令:

curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io

输出如下:

[master@localhost ~]$ curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
docker version >= 1.12
{"registry-mirrors": ["http://f1361db2.m.daocloud.io"]}
Success.
You need to restart docker to take effect: sudo systemctl restart docker 

然后使用命令sudo systemctl restart docker重启docker服务,拉取Redis的Image

latest: Pulling from library/redis
fc7181108d40: Downloading [=================================================> ]  22.24MB/22.49MB
3e0ac67cad82: Download complete 
6ee495cb7235: Download complete 
9f7206d08b9d: Download complete 
a8354ef8cccb: Waiting 
53afb10d81c2: Download complete 

打完收工,看来是网路问题,需要配置加速器

posted @ 2019-06-16 23:06  咕咚!  阅读(10477)  评论(0编辑  收藏  举报