卸载旧版本
如果安装过旧版本或在docker安装过程中提示冲突什么的,可先卸载旧版本。执行命令:
sudo yum remove docker docker-common docker-selinux docker-engine
centos 安装docker
官方参考地址:https://docs.docker.com/install/linux/docker-ce/centos/
里面包含包下载地址: https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
安装依赖
yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo yum install docker-ce docker-ce-cli containerd.io
如果报错:Problem: package docker-ce-3:19.03.4-3.el7.x86_64 requires containerd.io >= 1.2.2-3 那就先装新版的 containerd.io
1.安装新版本containerd.io
dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
2.再装剩下两个
yum install docker-ce docker-ce-cli
启动docker
systemctl start docker
查看版本
docker --version
开机自启
systemctl enable docker
感谢
- https://blog.csdn.net/yucaifu1989/article/details/103111317