卸载旧版docker(如果有)
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
安装docker依赖包
yum install -y yum-utils
设置docker仓库
# 这个地址不行,下面直接改为阿里云的
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
# 这是阿里云的
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
安装
yum install docker-ce docker-ce-cli containerd.io
启动等
# 状态
systemctl status docker
# 启动
systemctl start docker
# 关闭
systemctl stop docker
# 开机就启动
systemctl enable docker