Docker Community Forums

Share and learn in the Docker community.

ERROR: Couldn't connect to Docker daemon. You might need to install Docker:

docker

(alexus) #1

I’m running docker.service on Red Hat Enterprise Linux 7 and even though docker.service is running, docker-compose couldn’t connect to Docker daemon:

# docker-compose ps
ERROR: Couldn't connect to Docker daemon. You might need to install Docker:

https://docs.docker.com/engine/installation/
#

systemctl (docker.service):

# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2017-10-25 11:54:46 EDT; 19min ago
     Docs: http://docs.docker.com
 Main PID: 4072 (dockerd-current)
   Memory: 38.2M
   CGroup: /system.slice/docker.service
           ├─4072 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --authorization-plugin=rhel-push-plugin --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --selinux-enabled --log-driver=journald --signature-verification=false --add-registry registry.access.redhat.com
           └─4084 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --runtime docker-runc --runtime-args --systemd-cgroup=true

Oct 25 12:13:46 X.X.X dockerd-current[4072]: [1B blob data]
Oct 25 12:13:46 X.X.X dockerd-current[4072]: [45B blob data]
Oct 25 12:13:46 X.X.X oci-register-machine[6873]: 2017/10/25 12:13:46 Register machine: poststop 54a5e82053ed5d7b9006579660eb3706aad440e85180de03f1ebafe9c6174a62 0 /var/lib/docker/devicemapper/mnt/3d0bc3f5026fef930efdd1367f230ef249ba3ffc58c23543caacdc62347083b5/rootfs
Oct 25 12:13:46 X.X.X dockerd-current[4072]: time="2017-10-25T12:13:46.623208905-04:00" level=warning msg="failed to close stdin: rpc error: code = 2 desc = containerd: container not found"
Oct 25 12:13:46 X.X.X dockerd-current[4072]: time="2017-10-25T12:13:46.623513307-04:00" level=info msg="{Action=wait, Username=root, LoginUID=0, PID=6737}"
Oct 25 12:13:47 X.X.X dockerd-current[4072]: time="2017-10-25T12:13:47.021965047-04:00" level=info msg="{Action=remove, Username=root, LoginUID=0, PID=6737}"
Oct 25 12:13:47 X.X.X dockerd-current[4072]: time="2017-10-25T12:13:47.222976891-04:00" level=error msg="Handler for GET /v1.12/containers/54a5e82053ed5d7b9006579660eb3706aad440e85180de03f1ebafe9c6174a62/json returned error: devmapper: Unknown device 3d0bc3f5026fef930efdd1367f230ef249ba3ffc58c23543caacdc62347083b5"
Oct 25 12:13:47 X.X.X dockerd-current[4072]: time="2017-10-25T12:13:47.223060686-04:00" level=error msg="Handler for GET /v1.12/containers/54a5e82053ed5d7b9006579660eb3706aad440e85180de03f1ebafe9c6174a62/json returned error: devmapper: Unknown device 3d0bc3f5026fef930efdd1367f230ef249ba3ffc58c23543caacdc62347083b5"
Oct 25 12:13:47 X.X.X dockerd-current[4072]: time="2017-10-25T12:13:47.368322064-04:00" level=error msg="Handler for GET /v1.12/containers/54a5e82053ed5d7b9006579660eb3706aad440e85180de03f1ebafe9c6174a62/json returned error: devmapper: Unknown device 3d0bc3f5026fef930efdd1367f230ef249ba3ffc58c23543caacdc62347083b5"
Oct 25 12:13:47 X.X.X dockerd-current[4072]: time="2017-10-25T12:13:47.368899855-04:00" level=error msg="Handler for GET /v1.12/containers/54a5e82053ed5d7b9006579660eb3706aad440e85180de03f1ebafe9c6174a62/json returned error: devmapper: Unknown device 3d0bc3f5026fef930efdd1367f230ef249ba3ffc58c23543caacdc62347083b5"
# 

docker-compose --verbose ps:

# docker-compose --verbose ps
compose.config.config.find: Using configuration files: ./docker-compose.yml
docker.auth.find_config_file: Trying paths: ['/root/.docker/config.json', '/root/.dockercfg']
docker.auth.find_config_file: No config file found
Traceback (most recent call last):
  File "bin/docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 68, in main
  File "compose/cli/main.py", line 118, in perform_command
  File "compose/cli/command.py", line 37, in project_from_options
  File "compose/cli/command.py", line 99, in get_project
  File "compose/cli/command.py", line 74, in get_client
  File "site-packages/docker/api/daemon.py", line 177, in version
  File "site-packages/docker/utils/decorators.py", line 46, in inner
  File "site-packages/docker/api/client.py", line 189, in _get
  File "site-packages/requests/sessions.py", line 488, in get
  File "site-packages/requests/sessions.py", line 475, in request
  File "site-packages/requests/sessions.py", line 596, in send
  File "site-packages/requests/adapters.py", line 473, in send
requests.exceptions.ConnectionError: ('Connection aborted.', error(13, 'Permission denied'))
Failed to execute script docker-compose
#

Please advise.


(Think) #2

is a docker ps working or even that not? how about a sudo docker ps?


(alexus) #3

docker is working just fine…

I was able to figure it out, it was SELinux that was causing it, as soon as switch to permissive, it start working fine… so I switched back to enforcing and just created new policy and now everything is working as expected it)