When working with Docker, I usually end up with a bunch of running or stopped containers. Removing each one using
docker rm <id> is tedious. Here's a one liner to remove them all, including the ones that are stopped.
docker rm -f $(docker ps -aq)
-a: Show all containers (even those that are stopped)
-q: Only display numeric IDs
docker ps -aq will give us the list of all the container IDs. Once we have the container IDs, we pass it to
docker rm -f which will remove them all, even if they are running (thanks to