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"

--

--

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