We can remove all stopped containers with a single command. In this recipe, we'll create a bunch of containers in a stopped state, and then delete all of them.
Removing all stopped containers
Getting ready
Ensure that Docker daemon 1.13 (and above) are running on the host and can be connected through the Docker client. You will also need some containers in a stopped or running state in order to delete them.
How to do it...
Use the following command:
$ docker container prune [OPTIONS]
Let's first create a container, and then delete it using the following commands...