How to enable Proxy for Docker engine with or without authentication on CentOS 7, Red Hat Enterprise Linux 7?
Steps:
1. Edit Docker configuration file
Edit /etc/sysconfig/docker file and add the below code at the bottom:
a) using authentication
HTTP_PROXY=http://username:password@85.254.112.20:8080/
HTTPS_PROXY=https://username:password@85.254.112.20:8080/
NO_PROXY= host.tuxfixer.com,192.168.2.24
b) without authentication
HTTP_PROXY=http://85.254.112.20:8080/
HTTPS_PROXY=https://85.254.112.20:8080/
NO_PROXY= host.tuxfixer.com,192.168.2.24
2. Restart Docker engine
Don’t forget to restart Docker daemon in order for the changes to take effect:
[root@tuxfixer ~]# systemctl restart docker
Hello,
if using systemd there also an another option: using an service file in /etc/systemd/system/docker.service.d/
# /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment=”HTTP_PROXY=http://85.254.112.20:8080/”