How to remove all containers and images with single docker command?

These are a set of commands, which comes in handy when you are running out of disk space, or simply want to clean up your docker host.

Removing all stopped containers and unused images

To remove all unused containers, networks, images (all unused), and optionally, volumes, run the docker system prune command:

docker system prune
docker cleanup command - docker system prune
Docker cleanup – docker system prune command example

References