Docker Community Forums

Share and learn in the Docker community.

Proxy settings do not work for either /etc/default/docker or systemd drop-ins


(Pyboy) #1

I am running docker
Client:
Version: 18.09.1
API version: 1.39
Go version: go1.10.6
Git commit: 4c52b90
Built: Wed Jan 9 19:35:31 2019
OS/Arch: linux/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 18.09.1
API version: 1.39 (minimum version 1.12)
Go version: go1.10.6
Git commit: 4c52b90
Built: Wed Jan 9 19:02:44 2019
OS/Arch: linux/amd64
Experimental: false

on

Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic

Neither the /etc/default/docker file using service docker start nor the service.d drop_in work for getting the daemon to use the proxy server. The only way I could get the docker daemon to use the proxy was to manually launch docker like so
https_proxy=http://domain\user:password@proxy.mycompany.com:80 dockerd

Any ideas???


(Gary Forghetti) #2

Did you try this?

Direct link to the Docker proxy setup -> HTTP/HTTPS proxy


(Pyboy) #3

Yep and those instructions are totally ignored by either the systemctl or docker itself. In fact, they are so ignored that the systemctcl command to show properties can’t even find the Environment property. Flat out just doesn’t work.


(Gary Forghetti) #4

Hi. I just tried that example and it appears to be working for me. I’m running on Docker CE 18.09.1

root@manager:~# mkdir -p /etc/systemd/system/docker.service.d
root@manager:~# echo -e "[Service]\nEnvironment=\"HTTP_PROXY=http://proxy.example.com:80/\"" > /etc/systemd/system/docker.service.d/https-proxy.conf
root@manager:~# sudo systemctl daemon-reload
root@manager:~# sudo systemctl restart docker
root@manager:~# systemctl show --property=Environment docker
Environment=HTTP_PROXY=http://proxy.example.com:80/

(Pyboy) #5

Send me your output of lsb_release -a.


(Gary Forghetti) #6

Hi.

root@manager:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.1 LTS
Release:	18.04
Codename:	bionic

(Pyboy) #7

Interesting. Don’t know why that doesn’t work on my Ubuntu VM. Same exact setup.


(Pyboy) #8

systemctl set-environment command does the trick though.


(Gary Forghetti) #9

Great!
But I’m confused too why it did not work for you when you placed it in the /etc/systemd/system/docker.service.d/https-proxy.conf file…


(Goffinf) #10

Me too, I have been using dropin files for more than 3 years and docker versions stretching back that far, and they have worked exactly as documented for all that time on RHEL.


(Pyboy) #11

I’m not too worried about it at this point. I just wanted the registry container for a private registry and quite happy if no one can get to the docker.io from that box.