Create the config file:
mkdir -p /etc/systemd/system/docker.service.d && \
vi /etc/systemd/system/docker.service.d/http-proxy.conf
Put up the configs:
[Service]
Environment="HTTP_PROXY=socks5://127.0.0.1:8080"
Environment="HTTPS_PROXY=socks5://127.0.0.1:8080"
Flush changes:
sudo systemctl daemon-reload
Verify that the configuration has been loaded:
sudo systemctl show --property Environment docker
Restart Docker:
sudo systemctl restart docker