How to Pull a Docker Image from Public Docker Registry

Posted on

Introduction

This article contains a specific subject about docker. It is discussing on how to pull a docker image from a public docker registry. First of all, there is a certain requirement to execute a process which is running to provide a certain service. There must be a suitable docker image available in the local machine to provide it. That docker image is available in the public docker registry. For an example, in order to run MySQL Database Server’s process to accept and listen for any incoming request, it request a suitable image. Just pull or download it from the public docker registry.

 

Pulling Docker Image from Public Docker Registry

So, the following command is a command pattern for pulling the required docker image :

user@hostname:~$ docker pull
"docker pull" requires exactly 1 argument.
See 'docker pull --help'.

Usage:  docker pull [OPTIONS] NAME[:TAG|@DIGEST]

Pull an image or a repository from a registry
user@hostname:~$ 

The following is the example of the above command pattern executiono for pulling MySQL Database Server docker image :

user@hostname:~$ docker pull mysql/mysql-server:5.7
5.7: Pulling from mysql/mysql-server
Digest: sha256:e85be6e24e3b65728fcecf5cb6266d402ce569aa55ebf22d38b257d651dbddf6
Status: Image is up to date for mysql/mysql-server:5.7
user@hostname:~$

The above output command is presenting the result of the command execution. It is pulling MySQL Database Server with the version of ‘5.7’. Actually, the above output is showing an already available MySQL Database Server’s docker image in the local machine. The above example is just showing that the status of the image is currently updated because of the above command execution.

In order to prove that there is already a MySQL Database Server’s docker image available in the local machine. Just execute the command for displaying list of docker images in the local machine. The following is the command to display or to show the already downloaded MySQL Database Server’s docker image in the local machine :

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:~$ 

The above command execution is filtering the output of the command. If there is no filter using ‘| grep mysql’, it will list and display all of the avilable docker images in the local machine. Since there is a combination on execution the command with the filter of ‘| grep mysql’, it will display all docker images available in the local machine with the name containing ‘mysql’.

Leave a Reply