# 1:安装wget
sudo yum -i install yum
# 2: 更新yum到最新版本
sudo yum update
# 3: 卸载旧版本
sudo yum remove docker docker-common docker-selinux docker-engine
# 4:安装依赖包
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# 5:设置yum源
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# 6:查看版本
sudo yum list docker-ce --showduplicates | sort -r
# 7: 安装docker docker-ce默认安装最新版本,也可通过版本名安装
sudo yum install docker-ce
# 8:启动docker
systemctl start docker
# 9:设置开机启动
systemctl enable docker
# 10:查看docker状态
docker version
# 11:设置镜像加速(阿里)
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://71eo0yau.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload sudo systemctl restart docker
# 12: 查看镜像仓库地址
sudo docker info
# 13:登录阿里远程仓库
$ sudo docker login --username=xxxxx@qq.com registry.cn-hangzhou.aliyuncs.com