一、卸载:
bash
sudo yum install -y yum-utils
sudo yum remove docker-ce docker-ce-cli containerd.io
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
二、安装:
-
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
-
sudo yum install docker-ce docker-ce-cli containerd.io
-
设置开机自启:
bash
systemctl enable docker.service
三、启动docker服务:
bash
service docker start
***若docker服务未启动会出现(在相应的/var/run/路径下找不到docker的进程):
bash
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
若启动后执行docker ps还不行,需查看docker daemon是否在运行,若运行需停止docker服务再启动。
①查看:
bash
ps aux | grep docker
②停止docker服务:
bash
service docker stop
③启动docker服务:
bash
service docker start