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" .
3
Answers
Some of the solutions that you can try:
sudo systemctl restart docker.service
docker exec -it ContainerName /bin/bash
and then Kill the containerkill 1
sudo apparmor_status
then disable itsudo systemctl disable apparmor
then teardown the apparmorsudo service apparmor teardown
. Now check the status againsudo apparmor_status
I used wilon’s answer from https://forums.docker.com/t/restart-docker-from-command-line/9420/2
I ran
killall Docker && open /Applications/Docker.app
Once that was done, I ran
docker-compose down
and all containers stopped as expected.I had the same when running
docker-compose down
for one of my containers, everything worked fine again after runningdocker-compose restart
.I didn’t need to restart whole Docker service.