Docker單獨設置代理服務docker
Ubuntu16.04版本,編輯文件/lib/systemd/system/docker.service:代理
[Service] Environment="HTTP_PROXY=http://proxy.example.com:80/"
If you have internal Docker registries that you need to contact without proxying you can specify them via the NO_PROXY
environment variable:rest
Environment="HTTP_PROXY=http://proxy.example.com:80/" Environment="NO_PROXY=localhost,127.0.0.0/8,docker-registry.somecorporation.com"
Flush changes:code
$ sudo systemctl daemon-reload
Verify that the configuration has been loaded:ci
$ sudo systemctl show docker --property Environment Environment=HTTP_PROXY=http://proxy.example.com:80/
Restart Docker:it
$ sudo systemctl restart docker