Reputation: 635
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?
Upvotes: 1
Views: 6641
Reputation: 455
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
Upvotes: 1
Reputation: 3611
Use --force
or -f
shorthand to force-remove a container.
docker rm -f <your-container-name or id>
Upvotes: 2