Cannot kill container: <container-id>: tried to kill container, but did not receive an exit event

I cannot stop, remove or kill my docker container. Commands given below with their respective error messages:

1. docker stop <container-id>
2. docker kill <container-id>
3. docker rm <container-id>

I get

1. Error response from daemon: cannot stop container: <container-id>: tried to kill container, but did not receive an exit event
2. Error response from daemon: cannot kill container: <container-id>: tried to kill container, but did not receive an exit event
3. Error response from daemon: You cannot remove a running container <container-id>. Stop the container before attempting removal or force remove

Same error messages if i prefix everything with sudo and also the same messages if I run all of commands above with --force. How do I solve this? It seems like I can't stop, kill or remove the container because it does not "receive an exit event". Nothing here helps: Error response from daemon: cannot stop container - signaling init process caused "permission denied" .


Solution 1:

Some of the solutions that you can try:

  1. Restart the docker service: sudo systemctl restart docker.service
  2. Restart the Host Machine
  3. Enter inside the container docker exec -it ContainerName /bin/bash and then Kill the container kill 1
  4. You can disable the apparmor service so first check the status sudo apparmor_status then disable it sudo systemctl disable apparmor then teardown the apparmor sudo service apparmor teardown. Now check the status again sudo apparmor_status