1、设置用户使用代理(非必须)
[root@localhost ~]# cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
http_proxy=http://10.3.1.40:3128
https_proxy=http://10.3.1.40:3128
2、设置systemd docker.service
[root@localhost ~]# cat /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket
[Service]
Environment=HTTP_PROXY=http://10.3.1.40:3128/
Type=notify
ExecStart=/usr/bin/docker daemon -H fd://
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
[Install]
WantedBy=multi-user.target
3、配置重载
[root@localhost ~]# systemctl daemon-reload && systemctl start docker.service