Clean up unused Docker image space

Tiempo de lectura: < 1 minuto
Today we will learn how to free up disk space from unused images with Docker.

Before cleaning the images, you can use the following command to see how much space can be freed:

docker system df

This command will display a summary of the space used by different Docker resource categories, such as images, containers, volumes, and networks.

To free up unused space, we will run the following command:

docker system prune

This command will delete unused images, stopped containers, unused networks, and unused volumes. You will be asked to confirm the deletion before proceeding.

After running the command, you will receive a confirmation showing the amount of reclaimed space. You must confirm the action by typing y or yes and pressing Enter.

Total reclaimed space: XXXMB
Are you sure you want to delete all unused containers, networks, and images (yes/no)?

You can check the used space again after cleaning to confirm the space release:

docker system df

Remember that this command permanently deletes resources, so use it with caution to avoid the loss of important data.

Leave a Comment