Docker: Pull Command – Examples

The docker pull command serves for downloading Docker images from a registry.

By default, the docker pull command pulls images from Docker Hub, but it is also possible to manually specify the private registry to pull from.

Before running the docker pull command it needs to search the Docker registry for the image to download.

In the examples below i will show how to pull the CentOS image from the official repository.

Cool Tip: Image vs. Container … What is the difference? Read More →

Docker Pull Command

The syntax of the docker pull command:

$ docker pull [OPTIONS] [PATH/]IMAGE_NAME[:TAG]

Docker Pull Latest

Pull the latest version of an image:

$ docker pull centos

– or –

$ docker pull centos:latest

Docker Pull Specific Version

Pull a specific version of an image:
$ docker pull centos:centos7.4.1708

– or –

$ docker pull centos:7.4.1708

Docker Pull All Images

Pull all tagged images:

$ docker pull -a centos

Docker Pull From Private Registry

The syntax of the docker pull command for pulling an image from a private registry:

$ docker pull [OPTIONS] ADDRESS:PORT[/PATH]/IMAGE_NAME[:TAG]

Examples of pulling Docker images from a private repository:

$ docker pull registry.example.com:5000/test-image
$ docker pull registry.example.com:5000/projects/test-image:0.2
$ docker pull -a registry.example.com:5000/projects/test-image

If a registry is password protected, you should log in to it before pulling:

$ docker login registry.example.com:5000

3 Replies to “Docker: Pull Command – Examples”

  1. Is there a difference between a Docker registry and repository? You seem to use the words interchangeably here.

    1. Hello. There is no differences from my point of view.

  2. A docker REGISTRY is a web-server-like thing that publishes images and offers them for download. For example, docker.io.
    A docker REPOSITORY is a collection of images with the same name and different tags. For example “myhost:1000/myimage:v1” and “myhost:1000/myimage:v2” are both in the repository “myhost:1000/myimage”.
    I find this usage confusing, but I think I have accurately described what the Docker project does.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.