Skip to content

Proxy Configuration

xjd edited this page Dec 31, 2021 · 4 revisions

Note, here we assume you have proxy on 127.0.0.1:7070 (localhost, socks5).

MacOS

Put the following configuration in .docker/config.json:

{
  "proxies" : {
    "default" : {
      "httpsProxy" : "socks5h://host.docker.internal:7070",
      "httpProxy" : "socks5h://host.docker.internal:7070",
      "noProxy" : "192.168.0.1/16,127.0.0.0/8"
    }
  }
}

The host.docker.internal is the host ip address (127.0.0.1, host) inside docker.

Linux

On linux, we can't use host.docker.internal any more. The following might work:

{
  "proxies" : {
    "default" : {
      "httpsProxy" : "socks5h://172.17.0.1:7070",
      "httpProxy" : "socks5h://172.17.0.1:7070",
      "noProxy": "192.168.0.1/16,127.0.0.0/8"
    }
  }
}

If it doesn't work, try googling to find out the host ip address inside docker.

Option --host

After version 0.7.0, docker in capsule can work in 'host' mode(Linux Only). You can use '127.0.0.1` directly in docker container. See more in Use host networking