安装-docker

  centos7.4,通过yum安装。

1、设置合适的源:

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
yum -y install docker-ce
如yum需要使用代理,在/etc/yum.conf最后加入proxy=http://username:password@proxy_ip:port/

2、安装中遇到缺失依赖,依次解决。

3、需要用普通用户使用docker,要把普通用户加入docker组:gpasswd -a app docker

4、设置代理:

mkdir -p /etc/systemd/system/docker.service.d
cat > /etc/systemd/system/docker.service.d/https-proxy.conf << EOF
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/" "HTTPS_PROXY=https://proxy.example.com:443/" "NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,192.*.*.*"
EOF
systemctl daemon-reload
systemctl restart docker
systemctl show --property=Environment docker
原文地址:https://www.cnblogs.com/badwood316/p/14711837.html