Docker creates many layers of images as you build and run containers, which can result in large amounts of unused data. Docker provides a simple solution for cleaning up this unused data: docker system prune
.
Advertisements
The docker system prune
command removes unused data, including images, containers, networks, and volumes. This is useful for freeing up disk space and keeping your Docker environment running smoothly.
One of the most commonly used options with docker system prune
is the -a
or --all
flag. This option removes all unused images, not just dangling ones. Dangling images are images that are not associated with a container. Using the -a
flag will remove all images that are not in use by a container.
To run docker system prune, open a terminal and enter the command:
sudo docker system prune -a -f
Be careful when using this option, as it will delete all unused data without asking for confirmation.
You can also use docker system prune
with additional options to specify exactly what you want to remove. For example, you can use the --volumes
flag to remove unused volumes.
Advertisements
To see all available options for docker system prune, enter the following command:
docker system prune --help
Share your thoughts and questions in the comments below thank you.
you save my server disk space thanks.
thanks!