菜单

Administrator
发布于 2024-06-12 / 99 阅读
0

dockerhub代理

sing-box

官网

{
  "log": {
    "level": "info"
  },
  "inbounds": [
    {
      "type": "mixed",
      "tag": "mixed-in",
      "listen": "0.0.0.0",
      "listen_port": 7890
    }
  ],
  "outbounds": [
    {
      "tag": "proxy-out",

      "type": "vless",
      "server": "your.server.com",
      "server_port": 443,
      "uuid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
      "flow": "",
      "tls": {
        "enabled": true,
        "server_name": "your.server.com"
      },
      "transport": {
        "type": "ws",
        "path": "/your-path",
        "headers": {
          "Host": "your.server.com"
        }
      }
    }
  ],
  "route": {
    "final": "proxy-out",
    "auto_detect_interface": true
  }
}

设置docker代理

官方教程

mkdir -p /etc/systemd/system/docker.service.d/

cat <<EOF> /etc/systemd/system/docker.service.d/proxy.conf 
[Service]
Environment="HTTP_PROXY=http://127.0.0.1:12345"
Environment="HTTPS_PROXY=http://127.0.0.1:12345"
EOF

systemctl restart docker

docker info | grep -i proxy

# 构建镜像
可用此命令传输代理至构建容器中,建议sb监听127然后构建容器使用host模式.亦可监听0.0.0.0或内部IP,容器内代理地址更改为宿主机IP
docker build  --network host --build-arg http_proxy=http://127.0.0.1:7890   --build-arg https_proxy=http://127.0.0.1:7890      -t myimage:latest .