centos yum install docker-ce

卸载老版本

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

配置docker源并安装

安装yum-utils包将会生成yum-config-manager指令

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

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

启用服务并配置开机自启动

systemctl start docker && systemctl enable docker

也可以尝试以下方法

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

donation