In some cases, we need to pull some docker image through our custom proxy server.
HTTP_PROXY in current login terminal will not be useful for the
docker pull command.
proxychains-ng tool is the same situation.
This is because docker is divided into
docker pull command is executed by
dockerd service. So we need make sure
dockerd use proxy server.
The Docker daemon uses the
NO_PROXY environmental variables in its start-up environment to configure HTTP or HTTPS proxy behavior. You cannot configure these environment variables using the
So we can edit the systemd service file.
1.First create a new folder
$ sudo mkdir -p /etc/systemd/system/docker.service.d
2.Then create a new file named
3.Reload and restart
$ sudo systemctl daemon-reload
4.Verify that the configuration has been loaded and matches the changes you made, for example:
$ sudo systemctl show --property=Environment docker