search_pt / docker_delete.sh
bardd's picture
first commit
16d282e verified
raw
history blame contribute delete
574 Bytes
#!/bin/bash
echo "Stopping all running containers..."
docker stop $(docker ps -q)
echo "Removing all containers..."
docker rm $(docker ps -a -q)
echo "Removing all Docker images..."
docker rmi $(docker images -q)
echo "Removing all Docker volumes..."
docker volume rm $(docker volume ls -q)
echo "Removing all Docker networks..."
docker network rm $(docker network ls -q | grep -v "bridge\|host\|none")
echo "Pruning all unused Docker objects (dangling images, stopped containers, unused networks)..."
docker system prune -f --volumes
echo "Docker cleanup complete!"