Pull a specific image by tag from Docker Hub
In this step, you will learn how to pull a specific Docker image by its tag from Docker Hub. Docker Hub is a public registry that hosts many official and community-contributed Docker images. Pulling an image means downloading it from a registry to your local machine.
The basic command to pull an image is docker pull <image_name>:<tag>
. If you don't specify a tag, Docker will pull the latest
tag by default. However, it's a good practice to specify a tag to ensure you get a specific version of the image.
Let's pull the hello-world
image with the latest
tag. This is a very small image used to test if your Docker installation is working correctly.
docker pull hello-world:latest
You should see output indicating that Docker is downloading the image layers.
Using default tag: latest
latest: Pulling from library/hello-world
Digest: sha256:f52335ce493f8f15cfcf46725b2909db9087b688aedabbbd2a167ae30b6da6fc
Status: Downloaded newer image for hello-world:latest
docker.io/library/hello-world:latest
Now, let's pull the ubuntu
image with a specific tag, for example, 20.04
. This will download the Ubuntu 20.04 LTS image.
docker pull ubuntu:20.04
You will see similar output showing the download progress.
20.04: Pulling from library/ubuntu
... (download progress) ...
Status: Downloaded newer image for ubuntu:20.04
docker.io/library/ubuntu:20.04
To see the images you have pulled, you can use the docker images
command.
docker images
This command lists all the images stored on your local machine, including their repository, tag, image ID, creation time, and size.
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu 20.04 ... ... ...
hello-world latest ... ... ...
You have successfully pulled specific images by tag from Docker Hub.