Centos7 Docker-ce 安装并配置代理

卸载系统自带docker环境

sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine

增加yum源

sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

查看版本

yum list docker-ce --showduplicates | sort -r
docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable

安装最新版本

sudo yum install docker-ce docker-ce-cli docker-compose-plugin

安装指定版本

sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> docker-compose-plugin

启用并自启

sudo systemctl start docker ;sudo systemctl enable docker

配置代理

vim /etc/systemd/system/docker.service.d/override.conf

[Service] LimitCORE=1 Environment="HTTP_PROXY=http://192.168.9.8:1081" Environment="HTTPS_PROXY=http://192.168.9.8:1081" Environment="NO_PROXY=localhost,127.0.0.1,docker.vimll.com,.corp,*.aliyuncs.com,192.169.9.0/24,172.16.0.0/21"