docker 使用 http http_proxy
https://docs.docker.com/config/daemon/systemd/
# 代理 和 国内 镜像源 不要 同时使用,。。。
# "storage-driver": "overlay2",
apt install docker.io -y
proxy_url='192.168.10.20:7890'
mkdir -p /etc/systemd/system/docker.service.d
cat > /etc/systemd/system/docker.service.d/http-proxy.conf <<EOF
[Service]
Environment="HTTP_PROXY=http://${proxy_url}"
Environment="HTTPS_PROXY=http://${proxy_url}"
EOF
self_hub='192.168.10.101:5000'
cat > /etc/docker/daemon.json <<EOF
{
"bip":"10.199.123.1/24",
"log-level": "error",
"insecure-registries": ["${self_hub}"]
}
EOF
systemctl enable docker
systemctl daemon-reload
systemctl restart docker
推送到 自己的 镜像仓库
self_hub='192.168.71.1:5000'
function tag_img_and_push(){
docker tag ${1} ${self_hub}/${1}
docker push ${self_hub}/${1}
}
for i in $( docker images | grep -v 'TAG' | awk '{print $1":"$2}' | grep -v "${self_hub}" | grep -v '192.168' )
do
tag_img_and_push ${i} &
done
wait
标签:systemd,http,hub,self,代理,192.168,home,docker
From: https://www.cnblogs.com/ltgybyb/p/16861247.html