1、yum -y update
2、sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
3、 sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
4、设置稳定的仓库
阿里云:
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
清华大学源:
yum-config-manager --add-repo https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
5、安装 Docker Engine-Community
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
安装过程中会出现两次:Is this ok [y/N]: y ,都输入y,然后按Enter键
如果提示您接受 GPG 密钥,请选是
查看已启动的服务
systemctl list-units -lype=service
查看是否设置开机启动
systemctl list-unit-files | grep enable
设置开机启动
systemctl enable docker.service
关闭开机启动
systemctl disable docker.service
启动 Docker
systemctl start docker
通过运行 hello-world 镜像来验证是否正确安装了 Docker Engine-Community
docker run hello-world