1. 程式人生 > >Docker 獲取容器映象報錯

Docker 獲取容器映象報錯

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