sevilayerkan / docker-helper

Makes using Docker easier
MIT License
3 stars 1 forks source link

feat: Clean command #14

Open sevilayerkan opened 1 year ago

sevilayerkan commented 1 year ago

Clean command that deletes unused docker images could be useful. A common issue with using docker is the /var/lib/docker/ folder may take up gigabytes of space which will eventually cause an out of disk space issue on the host system.

Sometimes there are leftover docker images of previously ran docker containers that have not been cleaned up. These images can be removed by running the command below, which will remove all data of non-running containers. source

docker system prune -a --volumes

Removing unused and dangling images will help us to reclaim disk space. We can achieve this using the image prune child command. We can use the system prune child command to remove multiple unused objects in one go. This command removes all unused networks, images, containers (if closed), dangling build caches, and optionally, volumes.

docker image prune -a -f

sevilayerkan commented 1 year ago

Additional Resources

https://access.redhat.com/solutions/2334181 https://www.baeldung.com/linux/docker-fix-no-space-error