0
点赞
收藏
分享

微信扫一扫

docker配置http proxy代理


Configure the Docker client
On the Docker client, create or edit the file ​​​~/.docker/config.json​​ in the home directory of the user that starts containers. Add JSON similar to the following example. Substitute the type of proxy with httpsProxy or ftpProxy if necessary, and substitute the address and port of the proxy server. You can also configure multiple proxy servers simultaneously.

You can optionally exclude hosts or ranges from going through the proxy server by setting a noProxy key to one or more comma-separated IP addresses or hosts. Using the * character as a wildcard for hosts and using CIDR notation for IP addresses is supported as shown in this example:

{
"proxies":
{
"default":
{
"httpProxy": "http://192.168.1.12:3128",
"httpsProxy": "http://192.168.1.12:3128",
"noProxy": "*.test.example.com,.example2.com,127.0.0.0/8"
}
}
}

Save the file.

When you create or start new containers, the environment variables are set automatically within the container.

官网链接:
​​​https://docs.docker.com/network/proxy/​​


举报

相关推荐

0 条评论