Setting Up an HTTP/HTTPS Proxy

To set up an HTTP/HTTPS proxy in Docker 17.07 and higher for Linux, create or edit the ~/.docker/config.json file in the home directory of the user that starts containers:

"proxies":
{
"default":
{
"httpProxy": "http://127.0.0.1:3001",
"httpsProxy": "http://127.0.0.1:3001",
"noProxy": "*.test.example.com,.example2.com"
}
}
}

Please review the official Docker docs for more details and solutions for older Docker versions(opens in a new tab).

According to the Docker docs, “many Linux distributions use systemd to start the Docker daemon.” To set up a proxy for Docker via systemd, refer to the following example(opens in a new tab).