centos 7重装docker

1、卸载docker

  • 如果docker卸载不干净,那么在后期安装docker后启动docker会失败,出现Failed to restart docker.service: Unit not found.

运行如下命令,卸载docker

yum -y  remove  docker  docker-common  docker-selinux  docker-engine

2、安装docker

1、安装docker运行环境

yum  -y install gcc
yum  -y install gcc-c++

2、安装储存库

sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

3、设置镜像仓库

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

4、更新索引

yum makecache fast

5、安装 DOCKER CE

sudo yum install docker-ce

6、启动docker

systemctl enable docker #加入服务中,有的不需要
systemctl start  docker  #启动docker

7、测试下
https://www.runoob.com/docker/docker-install-nginx.html

你可能感兴趣的:(centos 7重装docker)