Skip to content

Registry

Introduction

A Docker Registry is a place where the Docker images can be stored in order to be publicly found, accessed, and used by the worldwide developers for quickly crafting fresh and composite applications without any risks.

Source: microsoft docs

A Docker Repository is a namespace that is used for storing Docker images. For instance, if your app is named hello-world-app and your username (hub-user) is my-hub-user then, in the Docker Repository, where the images of hello-world-app would be stored in the Docker Registry would be named my-hub-user/hello-world-app. You can also tag your images, e.g. if you tag your image with v1 then it can be accessed by

my-hub-user/hello-world-app:v1

For pushing an image to docker hub you need an account (hub-user). The push command looks as follows:

$ docker push <hub-user>/<repo-name>:<tag>

The following examples shows four repositories of google hub-user on Docker Hub (official registry of Docker company).

Working with Docker images

With the folloaing command you can pull the images from a remote registy into you local registry, where you can then build your new images based on the pulled one.

Usage:  docker pull [OPTIONS] NAME[:TAG|@DIGEST]
Options:
  -a,   --all-tags                  Download all tagged images in the repository   
        --disable-content-trust     Skip image verification (default true)
  -q,   --quiet                     Suppress verbose output

$ docker pull -a busybox 

The Docker engine downloads a few more images with the -a option By default, Docker always uses the image that is tagged as latest. Each image variant can be directly identified by qualifying it with its tag. An image can be tag-qualified by appending the tag to the repository name with a : that is added between the tag and the repository name (<repository>:<tag>). For instance, you can launch a container with the busybox:ubuntu-14.04 tag.

The images that are available on the Docker host can be checked by running the docker images subcommand

Usage:  docker images [OPTIONS] [REPOSITORY[:TAG]]
List images
Options:
  -a, --all             Show all images (default hides intermediate images)
      --digests         Show digests
  -f, --filter filter   Filter output based on conditions provided
      --format string   Pretty-print images using a Go template
      --no-trunc        Don't truncate output
  -q, --quiet           Only show numeric IDs

$ docker images
REPOSITORY  TAG      IMAGE ID         CREATED       SIZE
busybox     musl     ce6c1e7ac565     6 weeks ago   1.46MB
busybox     glibc    cf961e78c761     6 weeks ago   5.2MB
busybox     latest   6d5fcfe5ff17     6 weeks ago   1.22MB
busybox     uclibc   6d5fcfe5ff17     6 weeks ago   1.22MB

Searching Docker images

The Docker Hub repository typically hosts both the official images as well as the images that have been contributed by the third-party Docker enthusiasts.

You can search the Docker Hub registry through its search interface or by using the command line interface. Searching can find images by image name, username, or description:

Usage:  docker search [OPTIONS] TERM
Search the Docker Hub for images
Options:
  -f,   --filter filter     Filter output based on conditions provided
        --format string     Pretty-print search using a Go template
        --limit int         Max number of search results (default 25)
        --no-trunc          Don't truncate output

$ docker search mysql 
NAME                      DESCRIPTION                                       STARS     OFFICIAL    AUTOMATED
mysql                     MySQL is a widely used, open-source relation…     9106      [OK]
mariadb                   MariaDB is a community-developed fork of MyS…     3217      [OK]
mysql/mysql-server        Optimized MySQL Server Docker images. Create…     674                   [OK]
centos/mysql-57-centos7   MySQL 5.7 SQL database server                     67
mysql/mysql-cluster       Experimental MySQL Cluster Docker images. Cr…     61
centurylink/mysql         Image containing mysql. Optimized to be link…     61                    [OK]

Exercise

  1. Search all images of OpenJDK
  2. Which of them is official image?
  3. Which of them is automated?