2024-07-08
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
When Docker needs to pull the target image through a proxy server, you can configure a global proxy for Docker to achieve this.
Note: The proxy set by the temporary command export HTTP_PROXY on Linux is useful for curl, but not for docker pull.
Assume your proxy server address is proxy.example.com
, the port is 8080
, here are the specific steps:
1. Create or edit a configuration file
mkdir -p /etc/systemd/system/docker.service.d
touch /etc/systemd/system/docker.service.d/http-proxy.conf
2. Add content to the file
Environment="HTTP_PROXY=http://proxy.example.com:8080"
Environment="HTTPS_PROXY=http://proxy.example.com:8080"
3. Reload and restart the Docker service
systemctl daemon-reload
systemctl restart docker
4. Verify the configuration
docker info
You should see proxy configuration information similar to the following in the output:
HTTP Proxy: http://proxy.example.com:8080
HTTPS Proxy: http://proxy.example.com:8080
With these steps, you should be able to correctly configure the Docker daemon to use a proxy server for image pulling.
(END)