Docker安装问题:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon

今天手欠,把docker的repository地址修改了一下,然后在查看docker version的时候就出现一下问问题,折腾了我一个小时才最终解决问题。

分享一下过程,大家避免踩坑

问题:

错误提示如下:

[root@centos docker]# docker version
Client: Docker Engine - Community
 Version:           20.10.14
 API version:       1.41
 Go version:        go1.16.15
 Git commit:        a224086
 Built:             Thu Mar 24 01:49:57 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@centos docker]# systemctl restartdocker.service
Unknown operation 'restartdocker.service'.
[root@centos docker]# systemctl status docker -l
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Tue 2022-04-12 15:43:20 CST; 13min ago
     Docs: https://docs.docker.com
 Main PID: 1455 (code=exited, status=1/FAILURE)

Apr 12 15:43:18 centos systemd[1]: Unit docker.service entered failed state.
Apr 12 15:43:18 centos systemd[1]: docker.service failed.

Apr 12 15:43:20 centos systemd[1]: docker.service holdoff time over, scheduling restart.
Apr 12 15:43:20 centos systemd[1]: start request repeated too quickly for docker.service
Apr 12 15:43:20 centos systemd[1]: Failed to start Docker Application Container Engine.
Apr 12 15:43:20 centos systemd[1]: Unit docker.service entered failed state.
Apr 12 15:43:20 centos systemd[1]: docker.service failed.

Apr 12 15:43:36 centos systemd[1]: start request repeated too quickly for docker.service
Apr 12 15:43:36 centos systemd[1]: Failed to start Docker Application Container Engine.
Apr 12 15:43:36 centos systemd[1]: docker.service failed.

Apr 12 15:59:31 centos systemd[1]: docker.service holdoff time over, schedu
Apr 12 15:59:31 centos systemd[1]: start request repeated too quickly for d
Apr 12 15:59:31 centos systemd[1]: Failed to start Docker Application Conta
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has failed.
-- 
-- The result is failed.
Apr 12 15:59:31 centos systemd[1]: Unit docker.service entered failed state
Apr 12 15:59:31 centos systemd[1]: docker.service failed.
Apr 12 15:59:31 centos systemd[1]: start request repeated too quickly for d
Apr 12 15:59:31 centos systemd[1]: Failed to start Docker Application Conta
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has failed.


瞬间泪崩

思考了一下

首先想到就思路就是是不是修改了daemon.json 了repository地址导致的。

执行如下代码,验证自己的思路

docker debug

看到下图提示:

Docker安装问题:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon_第1张图片

 确定了的确是 repository地址错误的问题了

问题解决:

首先删除 /etc/yum.repos.d/docker-ce.repo 里面错误的 repository 的地址 操作如下:

cd /etc/yum.repos.d
Vim docker-ce.repo

发现了,多了一个错误的地址

Docker安装问题:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon_第2张图片

果断 删除

rm -tf e4fquiqb.mirror.aliyuncs.com.re

第2步:修改 daemon.json 的配置

vim /etc/docker/daemon.json

Docker安装问题:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon_第3张图片

再重新reload一下

systemctl daemon-reload

重新启动一下docker

systemctl restart docker

问题解决:

Docker安装问题:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon_第4张图片

 分享给大家,大家避免踩坑

你可能感兴趣的:(docker,docker,centos)