Introduction
Another article about docker usage is this article focusing on how to search a docker image. The search process for a docker image is using a docker command. Furthermore, it will search the docker image in the docker repository. In this context, currently it is a docker repository exist by default where it has a registry address of ‘https://registry-1.docker.io/v2/”‘. It is obvious as in the execution of the following command :
C:\Users\Administrator>docker pull centos Using default tag: latest Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) C:\Users\Administrator>
The above command execution is a command for pulling a docker image from the docker repository which exist online by default in the URL address of ‘https://registry-1.docker.io/v2/’. So, how to be able to search a certain the docker image with a specific name ?. There is a command in docker to do that.
Search Docker Image in a Docker Repository
So, the main focus of the article is just to search a certain docker image in the default docker image repository. The following is the pattern of the command for searching the image :
docker search image_name
Before going out to the main task for searching the docker image, just execute a command to ask for help about how to use the ‘docker search’ command as follows :
C:\Users\Administrator>docker search --help Usage: docker search [OPTIONS] TERM Search the Docker Hub for images Options: -f, --filter filter Filter output based on conditions provided --format string Pretty-print search using a Go template --limit int Max number of search results (default 25) --no-trunc Don't truncate output C:\Users\Administrator>
The sample execution of the above command pattern will be in the following output :
C:\Users\Administrator>docker search "docker search" requires exactly 1 argument. See 'docker search --help'. Usage: docker search [OPTIONS] TERM Search the Docker Hub for images C:\Users\Administrator>
So, as in the output of the above command execution, it will need an additional parameter with the above command ‘docker search’. It is the name of the docker image which is going to be searched. So, just add the parameter of the above command execution with the docker image name as follows for an example :
C:\Users\Administrator>docker search centos NAME DESCRIPTION STARS OFFICIAL AUTOMATED centos The official build of CentOS. 6908 [OK] ansible/centos7-ansible Ansible on Centos7 135 [OK] consol/centos-xfce-vnc Centos container with "headless" VNC session… 131 [OK] jdeathe/centos-ssh OpenSSH / Supervisor / EPEL/IUS/SCL Repos - … 121 [OK] centos/systemd systemd enabled base container. 105 [OK] centos/mysql-57-centos7 MySQL 5.7 SQL database server 92 imagine10255/centos6-lnmp-php56 centos6-lnmp-php56 58 [OK] tutum/centos Simple CentOS docker image with SSH access 48 centos/postgresql-96-centos7 PostgreSQL is an advanced Object-Relational … 45 jdeathe/centos-ssh-apache-php Apache PHP - CentOS. 31 [OK] kinogmt/centos-ssh CentOS with SSH 29 [OK] guyton/centos6 From official centos6 container with full up… 10 [OK] nathonfowlie/centos-jre Latest CentOS image with the JRE pre-install… 8 [OK] centos/tools Docker image that has systems administration… 7 [OK] drecom/centos-ruby centos ruby 6 [OK] darksheer/centos Base Centos Image -- Updated hourly 3 [OK] mamohr/centos-java Oracle Java 8 Docker image based on Centos 7 3 [OK] dokken/centos-7 CentOS 7 image for kitchen-dokken 2 miko2u/centos6 CentOS6 日本語環境 2 [OK] amd64/centos The official build of CentOS. 2 mcnaughton/centos-base centos base image 1 [OK] blacklabelops/centos CentOS Base Image! Built and Updates Daily! 1 [OK] myheritage/centos7-git-java CentOs based docker image for Jenkins slave 1 [OK] starlabio/centos-native-build Our CentOS image for native builds 0 [OK] smartentry/centos centos with smartentry 0 [OK] C:\Users\Administrator>