How to Search, Pull, List & Delete Docker Images on Linux

In our previous tutorials you have learned about installation of Docker engine on CentOS/RHEL and Ubuntu operating system and pulled images from Docker hub. After that created containers with images. This tutorial will help you to search, pull, list and delete Docker images from your host system.

Search Docker Images

First of all search Docker container images from Docker hub. For example, below command will search all images with Ubuntu and list as output
# docker search ubuntu 
The result will look like below
NAME                              DESCRIPTION          STARS     OFFICIAL   AUTOMATED  ubuntu                            Ubuntu is a Deb...   3318      [OK] ubuntu-upstart                    Upstart is an e...   60        [OK] torusware/speedus-ubuntu          Always updated ...   25                   [OK] ubuntu-debootstrap                debootstrap --v...   24        [OK] rastasheep/ubuntu-sshd            Dockerized SSH ...   22                   [OK] neurodebian                       NeuroDebian pro...   17        [OK] nuagebec/ubuntu                   Simple always u...   4                    [OK] nickistre/ubuntu-lamp-wordpress   LAMP on Ubuntu ...   4                    [OK] nimmis/ubuntu                     This is a docke...   3                    [OK]  

Pull Docker Images

Now pull required docker image from docker hub on your local system using following commands. Below command will download image named “ubuntu”.
# docker pull ubuntu  latest: Pulling from library/ubuntu  fa5be2806d4c: Pull complete b4af4261cb15: Downloading [==>               ] 3.779 MB/70.55 MB 5d358abc5d9c: Download complete 2933d50b9f77: Download complete 
We are also downloading centos images from docker hub.
# docker pull centos 

List Docker Images

Now make sure that above images has been downloaded successfully on your system. Below command list all images.
# docker images  REPOSITORY  TAG         IMAGE ID          CREATED           VIRTUAL SIZE ubuntu      latest      36248ae4a9ac      2 hours ago       188 MB centos      latest      2933d50b9f77      2 hours ago       196.6 MB 

Remove Docker Images

To remove an images, Docker provides rmi option. Using this we can delete any docker images from our local system. For example use below command with changing IMAGE ID with your Docker image id.
# docker rmi  <IMAGE ID> 
or you can simply remove images using repository name (image name)
# docker rmi ubuntu 
In case you have two images with same name, add tag name while deletion
# docker rmi  ubuntu:latest 

Thanks for Visit Here

Comments