1.查看下centos版本,docker要求高于3.10
[root@localhost /]# uname -r
3.10.0-327.el7.x86_64
2.升级下yum版本
yum update
3.安装下依赖包 // 发现这一步没用,提示我已经是最新的了
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
4.添加docker yum源
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
5.安装docker
sudo yum install -y docker-ce docker-ce-cli containerd.io
4.启用docker
sudo systemctl enable docker
5.启动docker
sudo systemctl start docker
6.查看版本
sudo docker --version
7.运行hello-world
docker run hello-world
--------------------------------------------------------遇到的错误----------------------------
1.不要用yum -y install docker, 这样子安装的是旧版本的 docker
2.selinux报错解决
报错
启动docker报错:"Job for docker.service failed because the control process exited with error"解决办法
关闭selinux
vi /etc/sysconfig/docker
3.卸载docker // 安装了错误版本的docker,就先卸载一下
yum erase docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine \
docker-ce
或
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
4.查找还有什么,继续卸载
yum list installed | grep docker
yum remove xx