Docker image command -Part-02

  1. List Docker images are to use following command.
$ docker images$ docker image ls
$ docker images --filter "<key>=<value>"
  • reference” : that can be used in order to isolate images having a certain name or tag;
  • before” : to filter images created “before” a specific point in time;
  • since” : to filter images since a specific point in time (usually another image creation);
  • label” : if you used the LABEL instruction to create metadata for your image you can filter them later with this key
  • dangling” : in order to isolate images that are not used anymore.
$ docker images --filter "reference=alpine"
$ docker images --filter "reference=alpine:3.12.8"
  • An unused image means that it has not been assigned or used in a container.
  • Dangling images are not images that are not used by any container anymore.
  • Dangling” images are created whenever you create a new version of a Docker image with the same image tag.
  • In other words, a dangling image just means that you’ve created with no tag and show untagged and displays “<none>.
$ docker images --filter "dangling=true"
$ docker images --filter "before=<image_name>"
$ docker images --filter "since=<image_name>"
$ docker images --quiet$ docker images -q
$ docker images -a | grep "alpine*"
$ docker images -a | grep "alpine*" | awk '{print $3}' | xargs docker rmi
$ docker rmi $(docker images -a -q)
$ docker image prune 
$ docker image prune -a
$ docker image prune -a --filter "until=168h"

--

--

--

DevOps Engineer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Creating a Technical Indicator From Scratch in Python.

CICD AWS codePipeline + Terraform + Manual Approval & SNS

What is Java? The JDK, JRE, and JVM.

Getting stuck in the details

LET: the next evolution of ETL and ELT

An imperfect guide to building the ultimate digital research assistant, the Under Cloud: Part 1

Don’t Build Another Large Community

Decentralizing my ideas on Web3

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Bikram

Bikram

DevOps Engineer

More from Medium

Introduction to Docker Compose

Jenkins to Push Docker Image to Docker Hub

My Understanding about RUN, CMD and ENTRYPOINT in Dockerfile

Launch a container in containerized docker