1.卸载旧版本,不管装没装过,执行一下,防止版本冲突
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2. yum安装gcc相关 以及 安装需要的软件包
需要确保centos系统可以连接外网
yum -y install gcc
yum -y install gcc-c++yum install -y yum-utils
3.设置国内镜像,速度会很快
全程输入y即可
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4.更新yum软件包索引
yum makecache fast
5.安装docker engine
yum install docker-ce docker-ce-cli http://containerd.io docker-compose-plugin
6.启动docker
systemctl start docke
7. 查看docker版本
8.测试:hello word
docker run hello-world
9. 卸载
systemctl stop docker
yum remove docker-ce docker-ce-clie http://containerd.io
rm -rf /var/lib/docker
rm -rf /var/lib/containerd
设置开机启动
systemctl enable docker.service
关闭开机启动
systemctl disable docker.service