File size: 574 Bytes
16d282e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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!"