skip to Main Content

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


  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
    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
  3. I had the same when running docker-compose down for one of my containers, everything worked fine again after running docker-compose restart.

    I didn’t need to restart whole Docker service.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search