Remove all stopped containers: "docker rm" requires at least 1 argument

In order to remove all our stopped containers, you can first run

$ docker ps -a

This gives you the list of running and stopped containers, from which you can select what are the containers that you wanted to get rid. But if you want to get rid of all stopped containers, then you need to use

$ docker container prune 

This removes all stopped containers by giving you the following messages.

Warning! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
Deleted Containers:
your container id list will be printed.

It could simply means that you have no container with a status 'exited'.

The commands becomes then:

sudo docker rm -v

The lack of any parameter would trigger the error message you see.

But today, this would be done with docker container prune anyway.

Tags:

Docker