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

Learning for Microsoft Azure Fundamentals (1) Load Balancers Notes

Azure API Management Policy for operation filter at API level policy

Set Operations On Dictionaries In Python- Set 1 [|] Operation

How to determine GCP project of a GCS bucket

Vote for Phala Network for the upcoming Polkadot Decoded 2022!

Web 3.0 — The FUTURE of Internet

Adding a Modular Power up System

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

Configure a local Jenkins instance

Install Minikube in Ubuntu

How To Install Jenkins on Ubuntu 20.04

The Host Network Driver | Networking in Docker #5