Skip to content

Docker代理配置

init

shell
sudo bash
apt install -y docker.io docker-compose make

config http-proxy.conf

shell
sudo mkdir /etc/systemd/system/docker.service.d

cat <<EOF | sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://<host>:1080"
Environment="HTTPS_PROXY=http://<host>:1080"
Environment="NO_PROXY=localhost,127.0.0.1"
EOF

systemctl daemon-reload && systemctl restart docker
docker info

config daemon.json

shell
cat <<EOF | sudo tee /etc/docker/daemon.json
{
  "registry-mirrors": [
    "https://docker.mirrors.ustc.edu.cn",
    "https://docker.m.daocloud.io",
    "https://dockerproxy.com",
    "https://docker.nju.edu.cn",
    "https://docker.1panel.live",
    "https://huecker.io"
  ],
  "proxies": {
    "http-proxy": "http://<host>:1080",
    "https-proxy": "http://<host>:1080",
    "no-proxy": "localhost,127.0.0.1"
  }
}
EOF

jq . /etc/docker/daemon.json
dockerd --config-file=/etc/docker/daemon.json --validate

systemctl daemon-reload && systemctl restart docker
docker info

chsrc

bash
curl https://chsrc.run/posix | sudo bash

镜像服务收录

Released under the MIT License.