1、如有旧版本先卸载
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2、**设置存储库**:安装`yum-utils`包
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
3、安装docker
sudo yum install docker-ce docker-ce-cli containerd.io
4、启动docker,并设置为开机自启
systemctl start docker
systemctl enable docker