HowTo Kill all Docker containers and remove all data

If you need for any reason to kill all docker containers and remove all docker-related data, use following procedure:

docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker network rm $(docker network ls -q)
docker volume rm $(docker volume ls -q)
docker system prune --all --volumes --force

What this will do?

  1. Stop and delete all docker containers
  2. Remove all docker images
  3. Remove all docker interfaces
  4. Remove all docker volumes
  5. Clear-up Docker system leftovers…

This will not uninstall Docker and/or docker compose, but now your system will be clean like after initial docker installation.