1.1 配置第三方yum源
yum -y install yum-utils
mv /etc/yum.repos.d/dvd.repo{,.bak}
wget -O /etc/yum.repos.d/centos-base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
1.2 生成缓存
yum makecache fast
yum repolist
1.3 安装Docker依赖
yum -y install yum-utils device-mapperpersistent-data lvm2
yum -y install docker-ce
1.4 配置Docker镜像加速
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors":
["https://ww9b0ehc.mirror.aliyuncs.com"]
}
EOF
1.5 启动
systemctl daemon-reload
systemctl restart docker
1.6 查看版本
docker version
docker info
vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1