为Docker容器设置http代理

为Docker容器设置http代理
以下内容复制⾃:,可以直接去该地址查看
HTTP/HTTPS proxy
The Docker daemon uses the HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environmental variables in its start-up environment to configure HTTP or HTTPS proxy behavior. You cannot configure these environment variables using the daemon.json file.
This example overrides the default docker.service file.
If you are behind an HTTP or HTTPS proxy server, for example in corporate settings, you need to add this configuration in the Docker systemd service file.
指数分布1. Create a systemd drop-in directory for the docker service:
$ sudo mkdir -p /etc/systemd/system/docker.service.d
2. Create a file called /etc/systemd/system/docker.service.f that adds the HTTP_PROXY environment variable:
云南盘鮈
[Service]
Environment="HTTP_PROXY=ample:80/"
Or, if you are behind an HTTPS proxy server, create a file called /etc/systemd/system/docker.service.f that adds
the HTTPS_PROXY environment variable:
[Service]
Environment="HTTPS_PROXY=ample:443/"
3. If you have internal Docker registries that you need to contact without proxying you can specify them via the NO_PROXY environment
variable:甲亢平片
沉默的忧伤
[Service]
Environment="HTTP_PROXY=ample:80/" "NO_PROXY=localhost,127.0.0.1,dock
er-registry.somecorporation"
Or, if you are behind an HTTPS proxy server:
[Service]
Environment="HTTPS_PROXY=ample:443/" "NO_PROXY=localhost,127.0.0.1,docker-registry.somecorporation"
4. Flush changes:
李冬民
$ sudo systemctl daemon-reload
5. Restart Docker:
$ sudo systemctl restart docker
6. Verify that the configuration has been loaded:
$ systemctl show --property=Environment docker
Environment=HTTP_PROXY=ample:80/
jnc mp3
Or, if you are behind an HTTPS proxy server:
$ systemctl show --property=Environment docker
Environment=HTTPS_PROXY=ample:443/

本文发布于:2024-09-23 00:32:59,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/164596.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:设置   查看   甲亢   容器   地址   平片   代理
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议