通过crproxy部署代理,通过魔法转发流量。
部署CRProxy
docker run -d --name crproxy \
--restart always \
-p 6443:443 \
-e http_proxy=http://10.10.10.3:20171 \
-e https_proxy=https://10.10.10.3:20171 \
-e no_proxy=127.0.0.1,localhost \
-e HTTP_PROXY=http://10.10.10.3:20171 \
-e HTTPS_PROXY=https://10.10.10.3:20171 \
-e NO_PROXY=127.0.0.1,localhost \
cleverest/crproxy
准备域名
假设域名设置为mirror.xzj.pub,并且有ssl证书,可以通过一下命令拉取镜像。
docker pull mirror.xzj.pub/docker.io/xxxxx:123
或者通过docker配置镜像加速站点。/etc/docker/daemon.json。则可以直接省略mirror.xzj.pub拉取docker.io的镜像。
{
"registry-mirrors": ["https://mirror.xzj.pub"]
}
如果没有域名,则需添加不检查域名的配置。
{
"registry-mirrors": ["https://192.168.3.33:6443"],
"insecure-registries": ["192.168.3.33:6443"]
}
重启docker服务。
systemctl daemon-reload && systemctl restart docker
更多内容请查看:Docker Image cleverest/crproxy