Docker

How to pull docker image?

Ways to pull the docker image

There are broadly two ways by which we can pull docker image to our local machine, where our docker client and docker daemon is installed.

  1. hub.docker.com
  2. dockerCLI

Pull docker images using “hub.docker.com”

Go to hub.docker.com, from there using the search box as shown in the picture below, search for your required image, we are going to use “alpine” image as an example.

how to search docker image on hub.docker.com

Using “dockerCLI”

Before pulling the image, we need to search for it from our terminal using docker’s command line interface (CLI), you must follow the commands as shown below.

Pull docker images using "dockerCLI"

sudo docker search –limit 2 alpine

From the picture above, it can be seen that we have 2 options available because of the argument used “–limit 2“, from these two options our image of interest is the first one, which is having “name = alpine” and “description = A minimal docker image based on alpine Linux“, “stars = 4857” and “official = OK“, “automated = OK“.

Now after figuring out which image we want to pull and use, we have to run the following command, in order to make it available locally.

sudo docker pull alpine

The command used above first communicates with the docker daemon and then the docker daemon communicates with the docker hub server.

Comment here