Why won't docker work?

Latest response

I recently installed docker on RHEL 7.2 and had a lot of trouble getting the daemon to start. I eventually rebooted the server and it did SEEM to start but I can't get any response from docker, which says the daemon is not running.

[Scott@Spock FIORd0_XFS]$ systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2017-08-18 11:40:12 EDT; 1h 16min ago
Docs: http://docs.docker.com
Main PID: 3179 (dockerd-current)
CGroup: /system.slice/docker.service
├─3179 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --authorization-plugin=rhel-...
└─3517 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 ...

Aug 18 11:40:10 Spock.RHEL dockerd-current[3179]: time="2017-08-18T11:40:10.530300967-04:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Aug 18 11:40:10 Spock.RHEL dockerd-current[3179]: time="2017-08-18T11:40:10.530762011-04:00" level=warning msg="mountpoint for pids not found"
Aug 18 11:40:10 Spock.RHEL dockerd-current[3179]: time="2017-08-18T11:40:10.531290461-04:00" level=info msg="Loading containers: start."
Aug 18 11:40:10 Spock.RHEL dockerd-current[3179]: ..time="2017-08-18T11:40:10.569282865-04:00" level=info msg="Firewalld running: true"
Aug 18 11:40:11 Spock.RHEL dockerd-current[3179]: time="2017-08-18T11:40:11.634355282-04:00" level=info msg="Default bridge (docker0) is assigned with an IP a... address"
Aug 18 11:40:12 Spock.RHEL dockerd-current[3179]: time="2017-08-18T11:40:12.005316065-04:00" level=info msg="Loading containers: done."
Aug 18 11:40:12 Spock.RHEL dockerd-current[3179]: time="2017-08-18T11:40:12.005460122-04:00" level=info msg="Daemon has completed initialization"
Aug 18 11:40:12 Spock.RHEL dockerd-current[3179]: time="2017-08-18T11:40:12.005493465-04:00" level=info msg="Docker daemon" commit="0fdc778/1.12.6" graphdrive...on=1.12.6
Aug 18 11:40:12 Spock.RHEL systemd[1]: Started Docker Application Container Engine.
Aug 18 11:40:12 Spock.RHEL dockerd-current[3179]: time="2017-08-18T11:40:12.033481075-04:00" level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.
[Scott@Spock FIORd0_XFS]$ docker pull servethehome/monero_cpu_minergate
Using default tag: latest
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
[Scott@Spock FIORd0_XFS]$ docker info
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
[Scott@Spock FIORd0_XFS]$ systemctl enable docker.service
[Scott@Spock FIORd0_XFS]$ systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2017-08-18 11:40:12 EDT; 1h 18min ago
Docs: http://docs.docker.com
Main PID: 3179 (dockerd-current)
CGroup: /system.slice/docker.service
├─3179 /usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --authorization-plugin=rhel-...
└─3517 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --shim docker-containerd-shim --metrics-interval=0 ...

Aug 18 11:40:10 Spock.RHEL dockerd-current[3179]: time="2017-08-18T11:40:10.530300967-04:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Aug 18 11:40:10 Spock.RHEL dockerd-current[3179]: time="2017-08-18T11:40:10.530762011-04:00" level=warning msg="mountpoint for pids not found"
Aug 18 11:40:10 Spock.RHEL dockerd-current[3179]: time="2017-08-18T11:40:10.531290461-04:00" level=info msg="Loading containers: start."
Aug 18 11:40:10 Spock.RHEL dockerd-current[3179]: ..time="2017-08-18T11:40:10.569282865-04:00" level=info msg="Firewalld running: true"
Aug 18 11:40:11 Spock.RHEL dockerd-current[3179]: time="2017-08-18T11:40:11.634355282-04:00" level=info msg="Default bridge (docker0) is assigned with an IP a... address"
Aug 18 11:40:12 Spock.RHEL dockerd-current[3179]: time="2017-08-18T11:40:12.005316065-04:00" level=info msg="Loading containers: done."
Aug 18 11:40:12 Spock.RHEL dockerd-current[3179]: time="2017-08-18T11:40:12.005460122-04:00" level=info msg="Daemon has completed initialization"
Aug 18 11:40:12 Spock.RHEL dockerd-current[3179]: time="2017-08-18T11:40:12.005493465-04:00" level=info msg="Docker daemon" commit="0fdc778/1.12.6" graphdrive...on=1.12.6
Aug 18 11:40:12 Spock.RHEL systemd[1]: Started Docker Application Container Engine.
Aug 18 11:40:12 Spock.RHEL dockerd-current[3179]: time="2017-08-18T11:40:12.033481075-04:00" level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.
[Scott@Spock FIORd0_XFS]$ docker info
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
[Scott@Spock FIORd0_XFS]$

Responses

Hi Scott,

Executing this command after installing docker did the trick (in my case at least) :

sudo systemctl enable --now docker

Maybe something went wrong when you installed it, so eventually a reinstall helps.

Cheers :)
Christian

Nope. Didn't work. I'll try uninstalling and re-installing it.

Found the problem. I needed to use sudo or be logged in as root. I can start the docker service - in fact it starts automatically now - as a regular user but I can't actually use docker without root-level privileges. I'm not sure why that is the case - seems dangerous to me - but it is at least working now.

Hi Scott,

Oh, I assumed that you actually were running docker as root and knew the reason why - well, this is the reason :
From Getting started with Docker -> "The Docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can access it with sudo. For this reason, Docker daemon always runs as the root user." You can find some more comprehensive information on the Project Atomic website : Why we don't let non-root users run Docker in CentOS, Fedora, or RHEL I hope this made it clear and could help. :)

Regards,
Christian

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.