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 37 38 39 40 41
| { "registry-mirrors": [ "https://registry.docker-cn.com", "http://hub-mirror.c.163.com", "https://docker.mirrors.ustc.edu.cn", "https://si7y70hh.mirror.aliyuncs.com/" ], ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H fd:// "hosts": ["unix:///var/run/docker.sock", "tcp://10.0.0.10:2375"], "insecure-registries": ["harbor.wang.org"], "exec-opts": ["native.cgroupdriver=systemd"], "graph": "/data/docker", ExecStart=/usr/bin/dockerd --data-root=/data/docker "max-concurrent-downloads": 10, "max-concurrent-uploads": 5, "log-opts": { "max-size": "300m", "max-file": "2" }, "live-restore": true, "proxies": { "default": { "httpProxy": "http://proxy.example.com:3128", "httpsProxy": "https://proxy.example.com:3129", "noProxy": "*.test.example.com,.example.org,127.0.0.0/8" } "tcp://docker-daemon1.example.com": { "noProxy": "*.internal.example.net" } } } systemctl daemon-reload ;systemctl restart docker.service
Docker 拉取镜像实现代理功能 cat >> /etc/systemd/system/docker.service.d/http-proxy.conf <<EOF [Service] Environment="HTTP_PROXY=http://${PROXY_SERVER_IP}:${PROXY_PORT}/" Environment="HTTPS_PROXY=http://${PROXY_SERVER_IP}:${PROXY_PORT}/" Environment="NO_PROXY=127.0.0.0/8,172.17.0.0/16,10.0.0.0/24,10.244.0.0/16,192.168.0.0/16,wang.org,cluster.local" EOF
|