Docker: Remove Container – Remove All Containers

To delete a particular Docker container firstly you have to find out the CONTAINER ID or NAME by listing the all Docker containers.

When the container for deletion is identified it can be removed with the docker rm command.

From the command-line it is also possible to remove stopped (unused) Docker containers only or, if it is needed, you can force removal of the all Docker containers.

Cool Tip: Clean up a Docker host by removing unused Docker images! The process is the same as during removal of the Docker containers! Read More →

List Docker Containers

List running Docker containers:

$ docker ps

List all Docker containers:

$ docker ps -a

Remove Docker Container

Remove Docker container by CONTAINER ID or NAME:

$ docker rm <container>

Force removal of a running Docker container:

$ docker rm -f <container>

Remove All Docker Containers

Remove all stopped (unused) Docker containers:

$ docker container prune -f

Force removal of the all Docker containers, including running containers:

$ docker rm -f $(docker ps -a -q)
Was it useful? Share this post with the world!

Leave a Reply