1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| mkdir -p /etc/systemd/system/docker.service.d
cat << EOF > /etc/systemd/system/docker.service.d/proxy.conf [Service] Environment="HTTP_PROXY=http://${ip}:${port}" Environment="HTTPS_PROXY=http://${ip}:${port}" Environment="NO_PROXY=127.0.0.1,localhost" EOF
cat << EOF > /etc/docker/daemon.json { # 指定路径 "graph": "/opt/lib/docker", "live-restore": true, "bip": "172.127.127.1/24", # dns解析地址 "dns": ["${ip}"], # 指定仓库 "registry-mirrors": ["${registry-address}"], # 信任 "insecure-registries": ["", "", ""] } EOF
exit sudo addgroup docker sudo usermod -aG docker $USER
sudo systemctl daemon-reload sudo systemctl restart docker
|