Dokcer 获取容器镜像报错
[[email protected] ~]# docker pull nginx
Using default tag: latest
Trying to pull repository docker.io/library/nginx ...
Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
因为在下载官方镜像点的镜像国内访问速度太慢,所以报错,使用加速器就可以解决这个问题
首先打开配置文件daemon.json,centos上安装后有此文件,但是ubuntu上需要自己创建文件:
[[email protected] ~]# vim /etc/docker/daemon.json
在文件中加入:
{
"registry-mirrors":["https://docker.mirrors.ustc.edu.cn"]
}
然后重启守护进程:
[[email protected] ~]# systemctl daemon-reload
[[email protected] ~]#systemctl restart docker
可以使用阿里的加速器:https://yq.aliyun.com/articles/29941
原文地址:http://blog.51cto.com/pengjc/2316566
时间: 2024-10-10 15:00:06