1.卸载旧版本
$ sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
2.安装需要的软件包
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
//设置yum源
sudo yum-config-manager \ --add-repo
https://download.docker.com/linux/centos/docker-ce.repo
#### 3.安装Docker CE
sudo yum install docker-ce
#### 4.启动并加入开机启动
sudo systemctl start docker
sudo systemctl enable docker
#### 5.验证是否安装成功
//一般包含client和server两部分代表安装成功docker version
#### 6.官方镜像加速
// /etc/docker/daemon.json
{
https://registry.docker-cn.com "registry-mirrors": [""]
}
#### 6.如果docker官方源无法下载则更换为阿里源
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
评论区