Error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Hi.

While am installing the volume of one image, via this command

docker run -it -v "$(pwd)":/data1 ubuntu

I got an error bout metadata and docker can not start " [Docker fails to start due to "volume store metadata database: timeout] "
so to solve this problem .

1- stope the docker and killed dokerd
2- rm /var/lib/docker/volumes/metadata.db
3- systemctl start docker

and I start to get
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

no matter what I did, I start the daemon on a terminal like this
dockerd

INFO[2021-09-20T01:15:48.913749465Z] Starting up
INFO[2021-09-20T01:15:48.916434292Z] parsed scheme: "unix"                         module=grpc
INFO[2021-09-20T01:15:48.916497400Z] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2021-09-20T01:15:48.916564792Z] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock  <nil> 0 <nil>}] <nil> <nil>}  module=grpc
INFO[2021-09-20T01:15:48.916595962Z] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2021-09-20T01:15:48.918298067Z] parsed scheme: "unix"                         module=grpc
INFO[2021-09-20T01:15:48.918347733Z] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2021-09-20T01:15:48.918388393Z] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock  <nil> 0 <nil>}] <nil> <nil>}  module=grpc
INFO[2021-09-20T01:15:48.918413515Z] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2021-09-20T01:15:48.939329092Z] [graphdriver] using prior storage driver: overlay
WARN[2021-09-20T01:15:48.939396810Z] [graphdriver] WARNING: the overlay storage-driver is deprecated, and will be removed in a future release
WARN[2021-09-20T01:15:48.952809659Z] Unable to find blkio cgroup in mounts
WARN[2021-09-20T01:15:48.952852651Z] Unable to find pids cgroup in mounts
INFO[2021-09-20T01:15:48.953507004Z] Loading containers: start.
INFO[2021-09-20T01:15:50.470316608Z] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address
INFO[2021-09-20T01:15:50.820419866Z] Loading containers: done.
INFO[2021-09-20T01:15:50.845100091Z] Docker daemon                                 commit=75249d8 graphdriver(s)=overlay version=20.10.8
INFO[2021-09-20T01:15:50.845282164Z] Daemon has completed initialization
INFO[2021-09-20T01:15:50.891007247Z] API listen on /var/run/docker.sock

I opened a new terminal to test
docker ps -l
it just hang and did not return any output.

and if I restart the service again, I will have the same error once I want to start docker
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

[MAX]root:[/root]cat /etc/os-release
NAME="CloudLinux"
VERSION="7.9 (Boris Yegorov)"
ID="cloudlinux"
ID_LIKE="rhel fedora centos"
VERSION_ID="7.9"
PRETTY_NAME="CloudLinux 7.9 (Boris Yegorov)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:cloudlinux:cloudlinux:7.9:GA:server"
HOME_URL="https://www.cloudlinux.com/"
BUG_REPORT_URL="https://www.cloudlinux.com/support"

[MAX]root:[/root]docker version
Client: Docker Engine - Community
 Version:           20.10.8
 API version:       1.41
 Go version:        go1.16.6
 Git commit:        3967b7d
 Built:             Fri Jul 30 19:55:49 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.8
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.6
  Git commit:       75249d8
  Built:            Fri Jul 30 19:54:13 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.9
  GitCommit:        e25210fe30a0a703442421b0f60afac609f950a3
 runc:
  Version:          1.0.1
  GitCommit:        v1.0.1-0-g4144b63
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
[MAX]root:[/root]docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.6.1-docker)
  scan: Docker Scan (Docker Inc., v0.8.0)

Server:
 Containers: 27
  Running: 0
  Paused: 0
  Stopped: 27
 Images: 6
 Server Version: 20.10.8
 Storage Driver: overlay
  Backing Filesystem: extfs
  Supports d_type: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: e25210fe30a0a703442421b0f60afac609f950a3
 runc version: v1.0.1-0-g4144b63
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-962.3.2.lve1.5.42.el7.x86_64
 Operating System: CloudLinux 7.9 (Boris Yegorov)
 OSType: linux
 Architecture: x86_64
 CPUs: 24
 Total Memory: 125.7GiB
 Name: server3.maximagroup.net
 ID: EPU2:7UOG:4ZC2:4VSU:S3K6:JYEW:FOXD:FH5G:EW4O:MKKO:EG7H:YPJM
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
WARNING: the overlay storage-driver is deprecated, and will be removed in a future release.
[MAX]root:[/root]

and yes I did review Post-installation steps for Linux | Docker Documentation
and nothing help

I was able to resolve this by following the advice in this StackOverflow post. In my case, like in the question, there were two instances of Docker that were competing, which was the root cause of the issue. This can be resolved with:

sudo systemctl stop docker
sudo dockerd