Prune Objects in Docker

Prune Objects in Docker

 Prune Objects in Docker


generally, Docker doesn’t remove unused objects (images, containers, volumes, and networks) from the system unless you explicitly ask Docker to do so. It provides an option to Prune the unused objects from the system.

Syntax:

docker [object] prune [options]

Where an object can be an image, continue volume, or a network.

Prune All Unused Objects

This will remove all unused objects like images, containers, volumes, and networks from the system.

$ docker system prune

The –all option will remove all unused images

$ docker system prune --all

The filtering flag (-f or –filter) format is “key=value”. Like until () will remove containers, images, and networks created before given timestamp

$ docker system prune --filter "until=24h"

Prune Images

This will remove all unused images from the system.

$ docker image prune

Prune Containers:

This will remove all unused volumes from the system.

$ docker container  prune 

–filter Provide filter values (e.g. ‘label=’)
–force , -f false Do not prompt for confirmation

Prune Volume:

This will remove all unused volumes from the system.

$ docker volume prune 

–filter Provide filter values (e.g. ‘label=’)
–force , -f false Do not prompt for confirmation

Prune Network:

This will remove all unused docker networks from the system.

$ docker network prune 

–filter Provide filter values (e.g. ‘label=’)
–force , -f false Do not prompt for confirmation

Reactions

Post a Comment

0 Comments

close