How to search for a container image


This entry is part 3 of 4 in the series Instructions for installing and using the Docker

SystemMen - This article will show you how to search for a container image. Thereby you will get the image you need to launch the container.

Docker Hub

First, I have to talk about Docker Hub. This is a huge Docker library, it contains image containers here and allows you to download.

Docker Hub is a place for you to manage your image containers (or the team). It allows you to create images, upload and download images.

how-to-search-for-a-container-image-01 How to search for a container image
Docker Hub library.

Temporarily, we’re not going to talk about how to create and upload images to Docker Hub, but we just stop figuring out how to find an image we need to use.

Search directly on the Docker Hub website

Okey, now you know the Docker Hub library. We will have the first way to go directly to the website and search for the image we need.

For example, I need a CentOS image, I will type centos in the search box on the website.

how-to-search-for-a-container-image-02 How to search for a container image
Search centos image in Docker Hub.

As a result, notice that the images are labeled OFFICIAL IMAGE. These are genuine images for all users. You should use it because it ensures clean images, does not contain underground viruses.

Here, I click on the first result, centos official image. Next I need to select the tag. You can understand the tag here is the different versions of the image that the provider creates. For example: centos 6, centos 7, … if you don’t know the version, you can choose latest.

how-to-search-for-a-container-image-04 How to search for a container image
Select tag of image.

For example, here I will choose CentOS with the tag of 7.6.1810. And now, look to the right of the screen, you will see the following command:

docker pull centos

This is the command to download the image to your computer. Now type that command and include the selected tag.

docker pull centos:7.6.1810

Search through the docker command

There is another way you can find the images you need, no need to visit the website. That is to use the docker command.

Docker has a search command that allows you to search for images directly from Docker Hub.

Type the search image centos command as follows.

docker search centos

And the result will show up as follows.

how-to-search-for-a-container-image-03 How to search for a container image
User docker search command to search centos image.

Now, you can also use the pull command to download the image you need to your computer.

docker pull centos:7.6.1810

Look like this.

root@linux:~# docker pull centos:7.6.1810
7.6.1810: Pulling from library/centos
ac9208207ada: Pull complete
Digest: sha256:6ae4cddb2b37f889afd576a17a5286b311dcbf10a904409670827f6f9b50065e
Status: Downloaded newer image for centos:7.6.1810

Check the downloaded image

Now you can check the images that you downloaded to the computer using the command below.

root@linux:~# docker image list
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
centos              7.6.1810            f1cb7c7d58b7        6 weeks ago         202MB
centos              7                   9f38484d220f        6 weeks ago         202MB
ubuntu              16.04               7e87e2b3bf7a        3 months ago        117MB

So you have successfully downloaded image centos 7.6.1810 on your device.

Conclusion

In this article, there is no difficult technique. It is simply a tutorial that shows you how to find the image container you need. This is the first step you need to learn, you can’t create the necessary containers if you don’t know how to find the image.

Continue reading the series«« Previous part: How to install Docker on Linux Mint 18Next part: How to list the tag of a container image »»


«« »»