1 使用yum -y install docker安装后启动docker提示Failed to start docker.service: Unit docker.service not found.可能与centos版本有关
2 正确的安装方式:
2.1 首先删除旧版本
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2.2 设置仓库
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
2.3 安装docker引擎
sudo yum install docker-ce docker-ce-cli containerd.io
2.4 开机自启
sudo systemctl enable docker
2.5 启动docker
sudo systemctl start docker