How to Show Available Docker Images in the Local Machine

Posted on

Introduction

This is another article which is focusing the content about docker. Docker itself is a container platform for running services. In its official website in this link, docker claims to be an only independent container platform that enables organizations to seamlessly build, share and run application, anywhere — from hybrid cloud to the edge. Furthermore, in that link, container is a standardized unit of software. Using docker platform, there can be lots of various software in the local machine. Those software is in the form of docker images. Furthermore, there is a specific command for listing those available docker images in the local machine.

Retrieving docker images is very easy. Just read the following link with the title of ‘How to Pull a Docker Image from Public Docker Registry’ to be able to get or to pull the suitable docker images. After successfully pulling docker images from either public or private docker registry, it will be available in the local machine.

 

Listing the available docker images in the local machine

The following command is a specific command to list all of them. Just execute the following command pattern :

docker images

Using the above command pattern, just execute it in the machine where it has docker installed :

user@hostname:~$ docker images
REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
centos-nginx_web              latest              36c49ff2d3bc        2 days ago          457MB
apache_image                  latest              2051d26d51fa        2 days ago          1.61GB
mariadb                       latest              7aca88b09cc5        5 days ago          356MB
wordpress                     latest              42a9bf5a6127        5 days ago          502MB
busybox                       latest              19485c79a9bb        13 days ago         1.22MB
php                           apache              aa4bdc74350b        2 weeks ago         414MB
php                           7.1-apache          1b3f4ce0de58        3 weeks ago         405MB
centos                        7                   67fa590cfc1c        4 weeks ago         202MB
centos                        latest              67fa590cfc1c        4 weeks ago         202MB
ubuntu                        latest              a2a15febcdf3        4 weeks ago         64.2MB
tomcat                        latest              6e30b06a90d3        4 weeks ago         506MB
mysql                         5.7                 e1e1680ac726        5 weeks ago         373MB
mysql                         latest              62a9f311b99c        5 weeks ago         445MB
mysql/mysql-cluster           latest              67fd04af4b8e        7 weeks ago         338MB
mysql/mysql-server            5.7                 d1469951af27        8 weeks ago         262MB
tensorflow/tensorflow         latest              7f03c4ff368a        2 months ago        1.17GB
centos                                            9f38484d220f        6 months ago        202MB
registry                      2                   f32a97de94e1        6 months ago        25.8MB
hello-world                   latest              fce289e99eb9        8 months ago        1.84kB
apache-php5                   latest              6bb5b2e462f9        17 months ago       479MB
user@hostname:~$   

The above command execution of ‘docker images’ will list all of the available docker images in the local machine. What about presenting or displaying only a certain docker image ?.¬† Actually, there is a modification of the command itself just to list certain docker image. Just modify the command by adding certain filter. Actually, the implementation of that filter is very simple. Just add an additional command for filtering the output of the command with certain character pattern as the filter¬† as follows :

user@hostname:~$ docker images | grep mysql
mysql                         5.7                 e1e1680ac726        5 weeks ago         373MB
mysql                         latest              62a9f311b99c        5 weeks ago         445MB
mysql/mysql-cluster           latest              67fd04af4b8e        7 weeks ago         338MB
mysql/mysql-server            5.7                 d1469951af27        8 weeks ago         262MB
user@hostname:~$

Since there is an additional output filter in the above command execution, the output will be different with the previous one. That filter is printing only the docker image which is match with the character specified in the ‘grep’ command filter.

Leave a Reply