Add local registry mirror or http(s) proxy to docker on ubuntu 16.04

Create this folder if this /etc/systemd/system/docker.service.d/ if it does not exist yet.

For adding local registry mirror add override.conf and file to the folder and the following config

sudo mkdir /etc/systemd/system/docker.service.d/
sudo vi /etc/systemd/system/docker.service.d/override.conf

ExecStart=/usr/bin/dockerd -H fd:// --registry-mirror=

For adding proxy to docker add proxy.conf with the following config

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

Environment="HTTP_PROXY=" "HTTPS_PROXY=" "NO_PROXY=localhost,,"

excluding because, that my local registry mirror 😉 in both cases you need to reload the systemd and docker daemon to take effect.

sudo systemctl daemon-reload
sudo service docker restart

After reload run
sudo docker system info
and see output to confirm the changes have taken effect

Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Http Proxy:
Https Proxy:
No Proxy: localhost,,
Experimental: false
Insecure Registries:
Registry Mirrors:
Live Restore Enabled: false

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.