Search code examples
dockerdocker-container

How do I kill the docker processes?


I have tried

docker kill name_of_the_process

But the error is

 Error response from daemon: Cannot kill container: name_of_the_container: Container name_of_the_container is not running

There are a lot of processes when I run docker ps -a, how do I kill those, they are stopped but not killed


Solution

  • A stopped container is killed. There is no running process, but there is a writable container specific filesystem and some metadata remaining which allows you to debug the stopped container and restart it. To remove that, use docker container rm (or the former alias docker rm) to remove the stopped container data. e.g.

    docker container ls -aqf status=exited | xargs docker container rm