看起来docker pull <image>忽略了http_proxy和https_proxy环境变量。我想截获通信,以便更好地理解docker pull执行的是哪些HTTP请求--有什么方法可以查看它们吗?
我在Ubuntu 18上执行docker pull。
发布于 2020-05-26 20:06:47
您可以在DockerClient中配置代理。
在Docker客户端上,在启动容器的用户的主目录下创建或编辑文件~/.docker/config.json。添加JSON,如下所示
{
"proxies":
{
"default":
{
"httpProxy": "http://127.0.0.1:3001",
"httpsProxy": "http://127.0.0.1:3001",
"noProxy": "*.test.example.com,.example2.com"
}
}
}发布于 2022-02-08 15:06:38
至少在我的例子中,上面的解决方案不适合我,因为我的环境是controlling docker with systemd
总而言之:
/etc/systemd/system/docker.service.d/http-proxy.conf的文件
Service Environment="HTTP_PROXY=http://proxy.example.com:80“Environment="HTTPS_PROXY=https://proxy.example.com:443”Environment="NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp"
sudo systemctl daemon-reload和sudo systemctl restart docker代理特定信息:https://docs.docker.com/config/daemon/systemd/#httphttps-proxy
https://stackoverflow.com/questions/62021587
复制相似问题