1

I am trying to kill (force stop) a MySQL DB container and it is refusing to die:

$ docker kill 55718df7a9d6
Error response from daemon: Cannot kill container: 55718df7a9d6: Container 55718df7a9d6600501bbd248fe0c1ef7da3f970fea84461cbe5f10c70f0cbe22 is not running
$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                          PORTS               NAMES
55718df7a9d6        mysql:8             "docker-entrypoint.s…"   3 minutes ago       Restarting (1) 58 seconds ago                       my-main-db

When I try to kill it:

$ docker stop 55718df7a9d6
55718df7a9d6
$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                          PORTS               NAMES
55718df7a9d6        mysql:8             "docker-entrypoint.s…"   19 minutes ago      Restarting (1) 17 minutes ago                       my-main-db

How can I force this to die and clean up so that docker ps returns no results?

1
  • You can use docker stop 55718df7a9d6 to remove it since it's not running. Commented Apr 6, 2021 at 19:14

2 Answers 2

2

Use --force or -f shorthand to force-remove a container.

docker rm -f <your-container-name or id>

Sign up to request clarification or add additional context in comments.

1 Comment

This just leads to "Could not kill running container <ID>, cannot remove - tried to kill container, but did not receive an exit event"
1

You should try to use the docker stop <id> command, since your container is restarting, if you try to kill it while it’s not running, you’ll get the error above

Updating the answer based on your new edit

You can forcefully delete your container by issuing the docker rm <container_id> -f and then recreate it

2 Comments

Thanks @EdwardKirk (+1), I should have mentioned that I tried that before. Please see my edits. How can I make it so that docker ps shows no results?
If it’s stuck in a restarting loop, you can try to forcefully delete docker rm 55718df7a9d6 -f and then recreate it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.