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