When you are trying to stop or kill the docker container, you may get the error response like – Error response from daemon: Can not kill container:xxx: Container xxx not running.

Error response from daemon: Cannot kill container: xxx: Container xxx is not running:

I got this error when I try to kill the container, I have spent almost 30 minutes to solve this. Followed the bellow git threads but nothing helped me.

https://github.com/docker/for-linux/issues/254

https://github.com/moby/moby/issues/10589

Issue:

Error response from daemon: Cannot kill container: xxx: Container xxx is not running.

Solution:

Restart the docker.socket,docker.service and remove the docker container.

$ sudo systemctl restart docker.socket docker.service
$ docker rm {container_id}

Done!

Check your luck 🙂