卸载旧版本

 sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

安装依赖的包

sudo yum install -y yum-utils

Docker安装地址

sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

Docker安装

sudo yum install docker-ce docker-ce-cli containerd.io

检查Docker的版本

docker -v

启动Docker

sudo systemctl start docker

查看安装的容器

sudo docker images

Docker设置开机自启

sudo systemctl enable docker