目录

一.将socks5的代理转换成http的代理

二.配置docker使用http的代理

三.拉取镜像 关闭镜像加速器


一.将socks5的代理转换成http的代理

1.安装 epel-release仓库和privoxy并编辑配置文件

yum -y install epel-release
yum -y install privoxy
vim /etc/privoxy/config

2.内容如下 

listen-address 0.0.0.0:8118 
forward-socks5t / 192.168.199.11:10808

192.168.199.11是可以访问谷歌的docker仓库的代理服务器

3.加入开机自启动并查看端口

systemctl enable privoxy --now
netstat -tunlp | grep 8118

二.配置docker使用http的代理

sudo mkdir -p /etc/systemd/system/docker.service.d 
sudo touch /etc/systemd/system/docker.service.d/proxy.conf 
sudo chmod 777 /etc/systemd/system/docker.service.d/proxy.conf 
sudo echo ' 
[Service] 
Environment="HTTP_PROXY=http://10.163.1.110:8118" Environment="HTTPS_PROXY=http://10.163.1.110:8118" 
' >> /etc/systemd/system/docker.service.d/proxy.conf 
sudo systemctl daemon-reload 
sudo systemctl restart docker

10.163.1.110是本机地址

三.拉取镜像 关闭镜像加速器

mv /etc/docker/daemon.json /etc/docker/daemon.json.bak
systemctl daemon-reload
systemctl restart docker
docker pull gcr.io/google-containers/ubuntu
docker pull gcr.io/google-containers/ubuntu:14.04
docker pull ubuntu:xenial-20210114
docker pull docker.io/library/ubuntu:latest

完成!!!

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐