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

I spent nearly a week on this issue and finally found the answer. The issue is not with Docker but is with systemctl and how it reads the config files. Systemctl requires different escape characters than a URL does so a proxy var with special URL characters needs to have then escaped with the hex equivalent and the systemctl escapes.

So a backslash in domain\user becomes domain%5Cuser but this breaks systemctl because of the % sign.

What I found is that systemctl uses doubles to escape special characters like % and $

So what you need for systemctl with a url and special chars is domain%%5Cuser (Notice the DOUBLE %).

[Service]
Environment="HTTP_PROXY=http://domain%%5Cuser:complex%%23pass@proxy.example.com:8080/"
1 Like