docker配置反向代理
Custom(定制) Docker daemon options
There are a number of ways to configure the daemon flags and environment variables for your Docker daemon. The recommended way is to use the platform-independent daemon.json file, which is located in /etc/docker/ on Linux by default. See Daemon configuration file.
You can configure nearly all daemon configuration options using daemon.json
Runtime directory and storage driver
You may want to control the disk space used for Docker images, containers, and volumes by moving it to a separate(單獨) partition(分開).
To accomplish this, set the following flags in the daemon.json
{ "graph": "/mnt/docker-data", "storage-driver": "overlay" }
HTTP/HTTPS proxy
Create a systemd drop-in directory for the docker service:
$ mkdir -p /etc/systemd/system/docker.service.d
Create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:
[Service] Environment="HTTP_PROXY=http://proxy.example.com:80/"
Or, if you are behind an HTTPS proxy server, create a file called /etc/systemd/system/docker.service.d/https-proxy.conf that adds the HTTPS_PROXY environment variable:
[Service] Environment="HTTPS_PROXY=https://proxy.example.com:443/"
If you have internal Docker registries that you need to contact without proxying you can specify them via the NO_PROXY environment variable
如果您有內部的Docker註冊中心,您需要聯系而不使用代理,您可以通過noproxy環境變量來指定它們:
Environment="HTTP_PROXY=http://proxy.example.com:80/" "NO_PROXY=localhost,127.0.0.1,docker-registry.somecorporation.com"
Or, if you are behind an HTTPS proxy server:
Environment="HTTPS_PROXY=https://proxy.example.com:443/" "NO_PROXY=localhost,127.0.0.1,docker-registry.somecorporation.com"
Flush changes:
$ sudo systemctl daemon-reload
Restart Docker:
$ sudo systemctl restart docker
Verify that the configuration has been loaded:
$ systemctl show --property=Environment docker Environment=HTTP_PROXY=http://proxy.example.com:80/
Or, if you are behind an HTTPS proxy server:
$ systemctl show --property=Environment docker Environment=HTTPS_PROXY=https://proxy.example.com:443/
本文出自 “11716212” 博客,請務必保留此出處http://11726212.blog.51cto.com/11716212/1976070
docker配置反向代理