Docker Cleanup Commands

User
delete all images containers ,mysqldb docker
Assistant
To delete all images, containers, and the MySQL database in Docker, follow these steps:

### **1. Remove All Containers**
Run the following command to stop and remove all running and stopped containers:

docker rm -f $(docker ps -aq)

### **2. Remove MySQL Volume (if any)**
If your MySQL database is stored in a volume, find and remove the volume:

docker volume ls  # List all volumes
docker volume rm <volume_name>  # Remove MySQL volume (replace <volume_name>)

To remove all unused volumes:

docker volume prune -f

### **3. Remove All Images**
To delete all Docker images, run:

docker rmi -f $(docker images -aq)

### **4. Remove All Networks (Optional)**
To remove all networks except the default ones:

docker network prune -f

### **5. Remove All Unused Docker Resources (Optional)**
To clean up everything (stopped containers, unused networks, dangling images, and unused volumes):

docker system prune -a -f

Let me know if you need a specific cleanup! ๐Ÿš€

User
check docker size
Assistant
To check the total size of Docker-related files on your system, run:

docker system df

This will display disk usage by containers, images, volumes, and build cache.

For more detailed information, use:

docker system df -v

Let me know if you need help cleaning up space! ๐Ÿš€

Leave a Comment

Your email address will not be published. Required fields are marked *