The stuff I do

Docker Using a proxy

← Notes

Tags: [docker][proxy]

In order to pull images (from instruction or docker pull command) via the proxy:

  1. Create a systemd drop-in directory:

    mkdir /etc/systemd/system/docker.service.d

  2. Add proxy in /etc/systemd/system/docker.service.d/http-proxy.conf file:

    # /etc/systemd/system/docker.service.d/http-proxy.conf

  3. Flush changes:

    systemctl daemon-reload

  4. Restart Docker:

    systemctl restart docker

In order to have the apt-get working inside the Dockerfile via the proxy you have to add some build args to the command:

docker build --build-arg http_proxy= --build-arg https_proxy= .

← Notes

Back to top