sajad torkamani
docker rm -f $(docker ps -aq)

docker ps -aq will give us the list of all Docker container IDs.

  • -a: Show all containers (even those that are stopped)
  • -q: Only display numeric 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 -f).

Tagged: Docker