Deleting all docker containers and images quickly

For when you really want to blat everything.

docker rm (docker ps -a -q) && docker rmi -f (docker image ls -q)

I'm using fish so the command substitution is a little different to the usual bash syntax. If you're running a more standard shell, you'll probably need some $s in there:

docker rm $(docker ps -a -q) && docker rmi -f $(docker image ls -q)

docker rm removes containers by container Id. docker ps -a -q lists all containers in quiet mode - so just the container Ids.

The logic is the same for removing images - I've thrown in the force flag for good measure, and I've used && to concatenate two commands onto one line.

This will error out if you have no containers.

It's also very destructive. A nuclear option as it were.`