Dangling or Unused Images in Docker

Jinna Baalu
1 min readNov 14, 2017

--

List Images

docker images

Filter Images

Filtering the docker images before or after the image

docker images -f since=<IMAGEID> # Get images sincedocker images -f before=<ImageID> # Get images Beforedocker images -f before=<ImagesID> -f since=<ImageId> # Get bwteen

Note : Filter are exclusive, it excludes the selected images and shows after or befor ethe images.

Dangling images are layers that have no relationship to any tagged images. They no longer serve a purpose and consume disk space. They can be located by adding the filter flag, -f with a value of dangling=true to the docker images

List Dangling images

docker images -f dangling=true

Remove single image or multiple images

docker rmi <imgae1-id> <image2-id> .....

Remove

Dangling images

docker rmi $(docker images -f dangling=true -q)

Remove all images

docker rmi $(docker rmi -q)

xargswill need --no-run-if-empty (-r) to bypass executing docker rmi with no arguments

docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Jinna Baalu
Jinna Baalu

Written by Jinna Baalu

Devops Solution Architect | Managing Consensus based Distributed Clusters | Centralised Logging 4M/15min | ELK | Prometheus | Kafka | Cassandra | Mongo

No responses yet

Write a response