You can add proxy configurations for the Docker client using a JSON configuration file, located in ~/.docker/config.json. Builds and containers use the configuration specified in this file.
{
"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"
}
}
}
Use host.docker.internal
instead of localhost
, for Linux an extra option is required: --add-host=host.docker.internal:host-gateway
Or use 172.17.0.1
instead of 127.0.0.1