Configure Proxy for Docker
If your network requires a proxy to pull images, you can configure the proxy in /etc/docker/daemon.json.
Configure Proxy for Docker Daemon
This will apply to docker pull.
Bash
vim /etc/docker/daemon.json
{
"proxies": {
"http-proxy": "http://USERNAME:PASSWORD@SERVER:PORT",
"http3-proxy": "http://USERNAME:PASSWORD@SERVER:PORT",
"no-proxy": "10.53.1.0/24,127.0.0.0/8"
}
}
https://docs.docker.com/config/daemon/#configure-the-docker-daemon
Configure Proxy for Docker Build and Run
Bash
docker build --build-arg HTTP_PROXY="http://USERNAME:PASSWORD@SERVER:PORT" .
docker run --env HTTP_PROXY="http://USERNAME:PASSWORD@SERVER:PORT" redis
https://docs.docker.com/network/proxy/#set-proxy-using-the-cli