When I try to kill the Docker daemon by:
docker kill $(docker ps -q)
I get the following error:
Error response from daemon: Cannot kill container: cf5fc4b0e5d1: Cannot kill container cf5fc4b0e5d152a7a89682d8835c40c59e9e0c2c41be4aae330ffeb8093814f2: connection error: desc = "transport: dial unix:///var/run/docker/containerd/docker-containerd.sock: timeout": unknown
Error response from daemon: Cannot kill container: 590fab6b49a2: Cannot kill container 590fab6b49a2e3c832a99074a0679558a9f826d79e94bae7be4ca12c3a019b69: connection error: desc = "transport: dial unix:///var/run/docker/containerd/docker-containerd.sock: timeout": unknown
When I try to stop the Docker daemon by:
docker stop $(docker ps -q)
I get this error:
Error response from daemon: cannot stop container: cf5fc4b0e5d1: Cannot kill container cf5fc4b0e5d152a7a89682d8835c40c59e9e0c2c41be4aae330ffeb8093814f2: connection error: desc = "transport: dial unix:///var/run/docker/containerd/docker-containerd.sock: timeout": unknown
Error response from daemon: cannot stop container: 590fab6b49a2: Cannot kill container 590fab6b49a2e3c832a99074a0679558a9f826d79e94bae7be4ca12c3a019b69: connection error: desc = "transport: dial unix:///var/run/docker/containerd/docker-containerd.sock: timeout": unknown
What is the proper way to stop the Docker daemon?
You need to stop the Docker daemon first and then start it.
To stop the Docker daemon:
sudo /etc/init.d/docker stop
To start the Docker daemon:
sudo /etc/init.d/docker start
This will reset Docker, after which all the commands should work properly.
If the above commands do not work, then just reboot:
sudo reboot
For macOS users: if you get the macOS equivalent:
ERROR: dial unix docker.raw.sock: connect: connection refused
You can restart Docker with the following:

I would suggest to run systemctl status docker and then either:
systemctl stop docker
systemctl start docker
Then verify whether docker daemon is up correctly or not with systemctl status docker.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With