After reading many articles and trying many things, this is how I solved it.
For docker daemon itself to use a proxy, configure environment variables using systemd file /etc/systemd/system/docker.service.d/http-proxy.conf :
[Service] Environment="HTTP_PROXY=http://user:pass@proxy.domain.com:3128/" Environment="HTTPS_PROXY=http://user:pass@proxy.domain.com:3128/" Environment="NO_PROXY=localhost,docker,*.domain.com" For gitlab-runner daemon itself to use a proxy, configure environment variables using systemd file /etc/systemd/system/gitlab-runner.service.d/http-proxy.conf :
[Service] Environment="HTTP_PROXY=http://user:pass@proxy.domain.com:3128/" Environment="HTTPS_PROXY=http://user:pass@proxy.domain.com:3128/" Environment="NO_PROXY=localhost,docker,*.domain.com" Reload systemd and restart docker daemon:
systemctl daemon-reload systemctl restart docker For git commands run by gitlab-runner to use a proxy, use gitlab-runner config file....