cleanup.sh 428 B

123456789101112131415
  1. #!/bin/bash
  2. # Step 1: Stop all running containers
  3. echo "Stopping all running containers..."
  4. docker stop $(docker ps -q)
  5. # Step 2: Remove all containers (running and stopped)
  6. echo "Removing all containers..."
  7. docker rm $(docker ps -a -q)
  8. # Optional: Remove all Docker images (if you want to clean up images too)
  9. # echo "Removing all Docker images..."
  10. # docker rmi $(docker images -q)
  11. echo "All containers have been removed."