Docker 代理设置

Docker 学习笔记目录

官方文档 Control Docker with systemd 使用 V2Ray

1. Create a systemd drop-in directory for the docker service:

1
sudo mkdir -p /etc/systemd/system/docker.service.d

2. Create a file named /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:

1
2
3
[Service]
Environment="HTTP_PROXY=http://127.0.0.1:10809"
Environment="NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp"

3. Flush changes and restart Docker

1
2
 sudo systemctl daemon-reload
 sudo systemctl restart docker

4. Verify that the configuration has been loaded and matches the changes you made, for example:

1
sudo systemctl show --property=Environment docker
Licensed under CC BY-NC-SA 4.0
comments powered by Disqus