美文网首页
Centos7 通过proxy 使用docker pull 镜像

Centos7 通过proxy 使用docker pull 镜像

作者: 永往直前 | 来源:发表于2021-03-22 16:07 被阅读0次

给Centos7加上网络代理后发现Docker依然无法联网查找原因才知道Docker需要额外配置代理,步骤如下:

1 创建目录

mkdir /etc/systemd/system/docker.service.d

2 创建配置文件

touch /etc/systemd/system/docker.service.d/http-proxy.conf

3 编辑文件并加入以下内容

vim  /etc/systemd/system/docker.service.d/http-proxy.conf

[Service]

Environment="HTTP_PROXY=http://ip:port"

4 更新重加载配置&重启Docker服务

systemctl daemon-reload

systemctl stop docker

systemctl start docker

实际环境中环境中代理在10.16.21.68, 端口是8888

[root@localhost ~]# vim /etc/systemd/system/docker.service.d/http-proxy.conf

[Service]

Environment="HTTP_PROXY=http://10.16.21.68:8888"

相关文章

网友评论

      本文标题:Centos7 通过proxy 使用docker pull 镜像

      本文链接:https://www.haomeiwen.com/subject/xdmfhltx.html