Sometimes, it happens that docker takes a lot of spaces when you create images and containers and over the period of time this space takes most of the part of your hard disk so it becomes necessary to clean this space. When you remove images and containers then also this space won’t be clean so there is a trick to free the space.
By default, volumes are not removed to prevent important data from being deleted if there is currently no container using the volume. Use the --volumes
flag when running the command to prune volumes as well:
Docker now has a single command to do that:
docker system prune -a --volumes
If you will run the above command this space will be cleaned and you will see a good amount of space in your hard drive.
Happy Coding !!
Leave a Reply