Pruning everything

If we just want to prune everything at once without having to enter multiple commands, we can use the following command:

$ docker system prune

The Docker CLI will ask us for a confirmation and then remove all unused containers, images, volumes, and networks in one go and in the right order.

Once again, to avoid Docker asking us for a confirmation, we can just use the force flag with the command.

Get Learn Docker - Fundamentals of Docker 18.x now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.