一.docker拉取镜像
docker pull centos出现如下错误
[root@my210 system]# docker pull centos
Using default tag: latest
Trying to pull repository docker.io/library/centos ...
Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
因为在下载官方镜像点的镜像国内访问速度太慢,所以报错,使用加速器就可以解决这个问题
解决:
[root@my210 system]# vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://5iabj71u.mirror.aliyuncs.com"]
}
2.重启
systemctl daemon-reload
systemctl restart docker
3.
[root@my210 system]# docker pull centos
Using default tag: latest
Trying to pull repository docker.io/library/centos ...
latest: Pulling from docker.io/library/centos
7dc0dca2b151: Pull complete
Digest: sha256:b67d21dfe609ddacf404589e04631d90a342921e81c40aeaf3391f6717fa5322
Status: Downloaded newer image for docker.io/centos:latest
[root@my210 system]#
二.网络环境需要代理的话
一般在/etc/environment、/etc/profile之类的配置可使用yum等
docker命令却使用不了这些代理
我们需要配置vi /usr/lib/systemd/system/docker.service
其他代理配置:
/etc/profile
http_proxy=http://xxx.cmcc:8080
export http_proxy
source /etc/profile 使其生效
/etc/yum.conf
proxy=http://xxx.cmcc:8080/
/etc/wgetrc
http_proxy = http://xxx.cmcc:8080/