Need help with stopping containers and starting Docker daemon

First project with Docker and I’m getting an endless series of Docker errors trying to get it to run.

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

2. sudo dockerd
INFO[2019-09-20T13:18:46.133337074-04:00] Loading containers: start.
ERRO[2019-09-20T13:18:46.566692903-04:00] error shutting down container container=b5aae95aa5551c8924e2449585f9b06fd3f3010567a3f287b6f7908be29b29ee error=“unknown error after kill: runc did not terminate sucessfully: container_linux.go:388: signaling init process caused "permission denied"\n: unknown”
ERRO[2019-09-20T13:18:46.571021483-04:00] error shutting down container container=7a9c35fee0c605ea5361032f2f2dcab019791439b797020da59382268b32e79c error=“unknown error after kill: runc did not terminate sucessfully: container_linux.go:388: signaling init process caused "permission denied"\n: unknown”
ERRO[2019-09-20T13:18:46.603725534-04:00] error shutting down container container=749d57a634c88c81898d9a60633f3703166b01506219ad21f5516a1622c3c24a error=“unknown error after kill: runc did not terminate sucessfully: container_linux.go:388: signaling init process caused "permission denied"\n: unknown”
ERRO[2019-09-20T13:18:46.613068074-04:00] error shutting down container container=1d42b40903dd781b55ce4692bef69fdb519a390fb0352ae7ab624d57d68914ac error=“unknown error after kill: runc did not terminate sucessfully: container_linux.go:388: signaling init process caused "permission denied"\n: unknown”

[…]

ERRO[2019-09-20T13:19:20.912298541-04:00] Stop container error: Failed to stop container 749d57a634c88c81898d9a60633f3703166b01506219ad21f5516a1622c3c24a with error: Cannot kill container 749d57a634c88c81898d9a60633f3703166b01506219ad21f5516a1622c3c24a: unknown error after kill: runc did not terminate sucessfully: container_linux.go:388: signaling init process caused “permission denied”
: unknown
ERRO[2019-09-20T13:19:21.035756039-04:00] Stop container error: Failed to stop container 7a9c35fee0c605ea5361032f2f2dcab019791439b797020da59382268b32e79c with error: Cannot kill container 7a9c35fee0c605ea5361032f2f2dcab019791439b797020da59382268b32e79c: unknown error after kill: runc did not terminate sucessfully: container_linux.go:388: signaling init process caused “permission denied”
: unknown
ERRO[2019-09-20T13:19:21.039657124-04:00] Stop container error: Failed to stop container 1d42b40903dd781b55ce4692bef69fdb519a390fb0352ae7ab624d57d68914ac with error: Cannot kill container 1d42b40903dd781b55ce4692bef69fdb519a390fb0352ae7ab624d57d68914ac: unknown error after kill: runc did not terminate sucessfully: container_linux.go:388: signaling init process caused “permission denied”
: unknown
ERRO[2019-09-20T13:19:21.065195686-04:00] Stop container error: Failed to stop container b5aae95aa5551c8924e2449585f9b06fd3f3010567a3f287b6f7908be29b29ee with error: Cannot kill container b5aae95aa5551c8924e2449585f9b06fd3f3010567a3f287b6f7908be29b29ee: unknown error after kill: runc did not terminate sucessfully: container_linux.go:388: signaling init process caused “permission denied”
: unknown

[…]

ERROR: Couldn’t connect to Docker daemon - you might need to run docker-machine start default.

3. docker-machine start default
Docker machine “default” does not exist. Use “docker-machine ls” to list machines. Use “docker-machine create” to add a new one.

4. docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS

5. docker-machine create default
Running pre-create checks…
Error with pre-create check: “VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path”

(This is ALREADY running in VirtualBox.)

6. docker system prune -a
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

(And… we’re back to Step 2.)

7. ps -aux | grep docker
root 732 0.7 0.4 1031128 69648 ? Ssl 12:51 0:17 dockerd -G docker --exec-root=/var/snap/docker/384/run/docker --data-root=/var/snap/docker/common/var-lib-docker --pidfile=/var/snap/docker/384/run/docker.pid --config-file=/var/snap/docker/384/config/daemon.json --debug
root 1908 0.4 0.2 535696 35512 ? Ssl 12:51 0:10 docker-containerd --config /var/snap/docker/384/run/docker/containerd/containerd.toml
root 2139 0.0 0.0 108752 5996 ? Sl 12:51 0:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/1d42b40903dd781b55ce4692bef69fdb519a390fb0352ae7ab624d57d68914ac -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
root 2206 0.0 0.0 108752 5576 ? Sl 12:51 0:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/7a9c35fee0c605ea5361032f2f2dcab019791439b797020da59382268b32e79c -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
root 2220 0.0 0.0 108752 5864 ? Sl 12:51 0:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/b5aae95aa5551c8924e2449585f9b06fd3f3010567a3f287b6f7908be29b29ee -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
root 2228 0.0 0.0 108752 5728 ? Sl 12:51 0:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/749d57a634c88c81898d9a60633f3703166b01506219ad21f5516a1622c3c24a -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
alan 9474 0.0 0.0 21532 1032 pts/0 S+ 13:30 0:00 grep --color=auto docker

8. sudo kill -9 732 1908 2139 2206 2220 2228 9474
kill: (9474): No such process

9. ps -aux | grep docker
root 9513 1.8 0.4 548292 67372 ? Ssl 13:31 0:00 dockerd -G docker --exec-root=/var/snap/docker/384/run/docker --data-root=/var/snap/docker/common/var-lib-docker --pidfile=/var/snap/docker/384/run/docker.pid --config-file=/var/snap/docker/384/config/daemon.json --debug
root 9591 1.1 0.2 427004 34536 ? Ssl 13:31 0:00 docker-containerd --config /var/snap/docker/384/run/docker/containerd/containerd.toml
alan 9732 0.0 0.0 21532 1000 pts/0 S+ 13:32 0:00 grep --color=auto docker

10. sudo dockerd
ERRO[2019-09-20T13:33:10.052053351-04:00] stream copy error: reading from a closed fifo
ERRO[2019-09-20T13:33:10.055863873-04:00] stream copy error: reading from a closed fifo
ERRO[2019-09-20T13:33:10.262184213-04:00] stream copy error: reading from a closed fifo
ERRO[2019-09-20T13:33:10.262303317-04:00] stream copy error: reading from a closed fifo
ERRO[2019-09-20T13:33:10.267496530-04:00] stream copy error: reading from a closed fifo
ERRO[2019-09-20T13:33:10.267566158-04:00] stream copy error: reading from a closed fifo
ERRO[2019-09-20T13:33:10.270654723-04:00] stream copy error: reading from a closed fifo
ERRO[2019-09-20T13:33:10.270781095-04:00] stream copy error: reading from a closed fifo
ERRO[2019-09-20T13:33:10.312017773-04:00] b5aae95aa5551c8924e2449585f9b06fd3f3010567a3f287b6f7908be29b29ee cleanup: failed to delete container from containerd: no such container
ERRO[2019-09-20T13:33:10.312071593-04:00] Failed to start container b5aae95aa5551c8924e2449585f9b06fd3f3010567a3f287b6f7908be29b29ee: OCI runtime create failed: container with id exists: b5aae95aa5551c8924e2449585f9b06fd3f3010567a3f287b6f7908be29b29ee: unknown
ERRO[2019-09-20T13:33:10.544669162-04:00] 749d57a634c88c81898d9a60633f3703166b01506219ad21f5516a1622c3c24a cleanup: failed to delete container from containerd: no such container
ERRO[2019-09-20T13:33:10.544766156-04:00] Failed to start container 749d57a634c88c81898d9a60633f3703166b01506219ad21f5516a1622c3c24a: OCI runtime create failed: container with id exists: 749d57a634c88c81898d9a60633f3703166b01506219ad21f5516a1622c3c24a: unknown
ERRO[2019-09-20T13:33:10.574145208-04:00] 7a9c35fee0c605ea5361032f2f2dcab019791439b797020da59382268b32e79c cleanup: failed to delete container from containerd: no such container
ERRO[2019-09-20T13:33:10.574214366-04:00] Failed to start container 7a9c35fee0c605ea5361032f2f2dcab019791439b797020da59382268b32e79c: OCI runtime create failed: container with id exists: 7a9c35fee0c605ea5361032f2f2dcab019791439b797020da59382268b32e79c: unknown
ERRO[2019-09-20T13:33:10.628397480-04:00] 1d42b40903dd781b55ce4692bef69fdb519a390fb0352ae7ab624d57d68914ac cleanup: failed to delete container from containerd: no such container
ERRO[2019-09-20T13:33:10.628424856-04:00] Failed to start container 1d42b40903dd781b55ce4692bef69fdb519a390fb0352ae7ab624d57d68914ac: OCI runtime create failed: container with id exists: 1d42b40903dd781b55ce4692bef69fdb519a390fb0352ae7ab624d57d68914ac: unknown

11. sudo docker-compose down
ERROR: Couldn’t connect to Docker daemon - you might need to run docker-machine start default.

12. docker info
Client:
Debug Mode: false

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

13. systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Fri 2019-09-20 13:05:38 EDT; 36min ago
Docs: https://docs.docker.com
Process: 813 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=0/SUCCESS)
Main PID: 813 (code=exited, status=0/SUCCESS)

Sep 20 13:05:38 Rms2 dockerd[813]: time=“2019-09-20T13:05:38.252797156-04:00” level=info msg=“Container failed to stop after sending signal 15 to the process, force killing”
Sep 20 13:05:38 Rms2 dockerd[813]: time=“2019-09-20T13:05:38.263334911-04:00” level=error msg="Stop container error: Failed to stop container 1d42b40903dd781b55ce4692bef69fdb519a390fb0352ae7ab624d57d68914ac with error: Cannot kill container 1d42b4090
Sep 20 13:05:38 Rms2 dockerd[813]: time=“2019-09-20T13:05:38.308699541-04:00” level=error msg="Stop container error: Failed to stop container 7a9c35fee0c605ea5361032f2f2dcab019791439b797020da59382268b32e79c with error: Cannot kill container 7a9c35fee
Sep 20 13:05:38 Rms2 dockerd[813]: time=“2019-09-20T13:05:38.360664931-04:00” level=error msg=“Stop container error: Failed to stop container 749d57a634c88c81898d9a60633f3703166b01506219ad21f5516a1622c3c24a with error: Cannot kill container 749d57a63
Sep 20 13:05:38 Rms2 dockerd[813]: time=“2019-09-20T13:05:38.375034860-04:00” level=error msg=“Stop container error: Failed to stop container b5aae95aa5551c8924e2449585f9b06fd3f3010567a3f287b6f7908be29b29ee with error: Cannot kill container b5aae95aa
Sep 20 13:05:38 Rms2 dockerd[813]: time=“2019-09-20T13:05:38.399806795-04:00” level=error msg=“failed to get event” error=“rpc error: code = Unavailable desc = transport is closing” module=libcontainerd namespace=moby
Sep 20 13:05:38 Rms2 dockerd[813]: time=“2019-09-20T13:05:38.399885153-04:00” level=info msg=“stopping event stream following graceful shutdown” error=”” module=libcontainerd namespace=moby
Sep 20 13:05:38 Rms2 dockerd[813]: time=“2019-09-20T13:05:38.400811391-04:00” level=info msg=“Daemon shutdown complete”
Sep 20 13:05:38 Rms2 dockerd[813]: time=“2019-09-20T13:05:38.400841307-04:00” level=error msg=“remove /var/run/docker.pid: no such file or directory”
Sep 20 13:05:38 Rms2 systemd[1]: Stopped Docker Application Container Engine.
lines 1-17/17 (END)

==================================

So… Things don’t run because the Docker daemon isn’t running. I can’t start the Docker daemon because there are containers running. I can’t stop the containers by killing the Docker processes. I can’t prune Docker because the Docker daemon isn’t running.

How can I stop these containers? How can I start the Docker daemon?

Thanks,
Alan

Ubuntu 18.04.3 LTS bionic
Client: Docker Engine - Community
Version: 19.03.2
API version: 1.40
Go version: go1.12.8
Git commit: 6a30dfc
Built: Thu Aug 29 05:29:11 2019
OS/Arch: linux/amd64
Experimental: false

Hello
“Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?”
Solve this Error to use of this command
Sudo systemctl start docker
so That error is solve
If docker service start you will not able to start dockerd

Thanks for the suggestion! It worked.