您的位置:首页 >资讯列表 > 正文
发布时间:2021-07-29 15:05
CentOS7配置Docker HTTP代理

随笔记录,因为公司网络隔离问题,上网需要配置指定的DNS,使用docker pull命令拉取镜像的时候会出现很多报错异常,接下来就通过HTTP代理解决问题。

 

1、指定目录新建docker.service.d文件夹和docker proxy.conf

 sudo mkdir -p /etc/systemd/system/docker.service.d

 sudo touch /etc/systemd/system/docker.service.d/proxy.conf

2、编辑proxy.conf,内容如下:

[Service]

Environment="HTTP_PROXY=http://h.feizhuip.com:8080/"

Environment="HTTPS_PROXY=http://h.feizhuip.com:8080/"

Environment="NO_PROXY=localhost,127.0.0.1,.example.com"

注意:替换成自己的代理地址

 

3、加载代理配置和重启docker服务

systemctl daemon-reload

service docker restart

4、docker info 验证代理是否配置成功,如下39,40行

 

Containers: 0

 Running: 0

 Paused: 0

 Stopped: 0

Images: 2

Server Version: 18.03.0-ce

Storage Driver: overlay2

 Backing Filesystem: xfs

 Supports d_type: true

 Native Overlay Diff: true

Logging Driver: json-file

Cgroup Driver: cgroupfs

Plugins:

 Volume: local

 Network: bridge host macvlan null overlay

 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog

Swarm: inactive

Runtimes: runc

Default Runtime: runc

Init Binary: docker-init

containerd version: cfd04396dc68220d1cecbe686a6cc3aa5ce3667c

runc version: 4fc53a81fb7c994640722ac585fa9ca548971871

init version: 949e6fa

Security Options:

 seccomp

  Profile: default

Kernel Version: 3.10.0-862.el7.x86_64

Operating System: CentOS Linux 7 (Core)

OSType: linux

Architecture: x86_64

CPUs: 48

Total Memory: 251.4GiB

Name: scm

ID: M2SP:5JTN:TGQV:MXFT:H5BG:CJD7:MI6Y:4IEH:3GCU:6IKF:FXPQ:FLG5

Docker Root Dir: /var/lib/docker

Debug Mode (client): false

Debug Mode (server): false

HTTP Proxy:

HTTPS Proxy:

No Proxy: localhost,127.0.0.1,.example.com

Username: howdylovely

Registry: h.feizhuip.com

Labels:

Experimental: false

Insecure Registries:

 10.0.0.12:5000

 127.0.0.0/8

Registry Mirrors:

 http://h.feizhuip.com/

Live Restore Enabled: false

5、使用docker pull redis 拉取镜像验证是否成功!


上一篇 nginx实战之:配置https反向代理tomcat http 下一篇 什么是HTTP代理,如何使用HTTP代理IP
在线咨询
微信客服

微信客服

微信公众号

微信公众号

回到顶部