docker代理配置 pull 加速

作者: print("") 分类: 信息安全 发布时间: 2021-01-21 16:01

一、代理加速

这里是socket5 127.0.0.1:23333

然后burp 代理一下处理

[root@localhost ~]#mkdir -p /etc/systemd/system/docker.service.d
[root@localhost ~]#vi /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://192.168.1.75:8080"

[root@localhost ~]#vi /etc/systemd/system/docker.service.d/https-proxy.conf
[Service]
Environment="HTTPS_PROXY=http://192.168.1.75:8080"

重启服务
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl restart docker

设置完之后设置一个证书

yum install -y ca-certificates

update-ca-trust force-enable

[root@localhost aaa]# wget http://192.168.1.75:8080/cert
--2021-01-21 15:54:40--  http://192.168.1.75:8080/cert
正在连接 192.168.1.75:8080... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:973 [application/octet-stream]
正在保存至: “cert”

cert                     100%[==================================>]     973  --.-KB/s  用时 0s      

2021-01-21 15:54:40 (239 MB/s) - 已保存 “cert” [973/973])

[root@localhost aaa]# ls
cert
[root@localhost aaa]# cp cert /etc/pki/ca-trust/source/anchors/


update-ca-trust extract

systemctl restart docker

然后进行pull 镜像

[root@localhost aaa]# docker pull ismaleiva90/weblogic12
Using default tag: latest
latest: Pulling from ismaleiva90/weblogic12
Image docker.io/ismaleiva90/weblogic12:latest uses outdated schema1 manifest format. Please upgrade to a schema2 image for better future compatibility. More information at https://docs.docker.com/registry/spec/deprecated-schema-v1/
a3ed95caeb02: Pull complete 
b82337cd1027: Pull complete 
9e3715b1d6be: Pull complete 
3247d9683c11: Pull complete 
b8c01449cf4a: Pull complete 
91c32b48ce3b: Waiting 
c617a682e3f2: Download complete 
83083f09438c: Download complete 
fe83b45f7a9f: Download complete 
db497d879495: Waiting 
2a44b564a6af: Download complete 
cf65f5fbc4e9: Waiting 
37170691a3c4: Waiting 
59fd638f77cf: Waiting 
c0a9d25582e2: Waiting 
816614cf1ec2: Waiting 
5cf15f6bb208: Waiting 
eebf27ebdf8a: Waiting 
5d3a0c287a13: Waiting 
fec10779fa63: Waiting 

如果需要使用socket5 代理就把

Environment=”HTTP_PROXY=socks5://代理ip:代理端口/”

 二、阿里云镜像加速

登陆阿里云

点击进去

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://xxxxxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。 必填项已用*标注