docker - docker-ce 19.03.5 在尝试启动从 docker hub 抓取图像的容器时不会使用代理
问题描述
预期行为
I would expect to see traffic trying to hit my proxy server when docker grabs images from docker hub.
实际行为
I see traffic trying to go directly to docker hub and is not using the proxy specified in the environment variable
重现行为的步骤设置代理变量并确保它设置为:
echo $HTTP_PROXY
尝试通过指定 HTTP_PROXY 变量来使用 golang 运行容器
docker run -e HTTP_PROXY golang:1.9
我也尝试通过在此处创建文件来设置 systemd 配置: /etc/systemd/system/docker.service.d/http-proxy.conf 然后运行 systemctl daemon-reload 然后 service docker restart
docker版本的输出:
Docker version 19.03.5, build 633a0ea838
Output of docker info:
docker info
Client:
Debug Mode: false
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 19.03.5
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.4.0-170-generic
Operating System: Ubuntu 16.04.6 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 992.1MiB
Name: cmsp-sand1
ID: BPFR:QNXD:WVD5:5TXT:AXDQ:YNXT:APCN:U4XS:7OTZ:73NP:JW34:KNSM
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
Additional environment details (AWS, VirtualBox, physical, etc.)
This is running on a virtualbox vagrant VM (ubuntu16.04.6) this nested inside a hyper-v VM running ubuntu 18.04.1
解决方案
我从 systemd http-proxy.conf 文件中删除了 HTTPS_PROXY 设置并修复了它,显然我的代理不支持 tls 连接,所以我不需要 HTTP_PROXY 和 HTTPS_PROXY
推荐阅读
- amazon-web-services - s3 存储桶策略访问对象 url
- python - 如何在 PyQt 中绘制自定义椭圆形状?
- linux - 如何打开和编辑 server.properties(在 kafka 中)
- python-3.x - 试图通过硒关闭便携式浏览器
- reactjs - 如何解耦 npm 包并用未打包的直接版本的源代码替换代码库?
- r - 将列表保存为矩阵的元素
- android - 如何实现文件选择器android 11
- javascript - 如何根据javascript中存在的键等条件获取新的数组对象
- java - java中的索引越界
- c# - 关闭 webview xamarin 表单