Registries & Docker Hub

A registry is a service that stores and distributes Docker images; Docker Hub is the default public one.

A registry is a server that stores Docker images so they can be shared and pulled. It is to images what GitHub is to code.

Docker Hub

Docker Hub is the default public registry. When you run docker pull nginx, Docker fetches the image from Docker Hub. It hosts official images (maintained by Docker or the software's authors) and community images.

Other registries

  • GitHub Container Registryghcr.io.
  • Amazon ECR, Google Artifact Registry, Azure Container Registry — cloud provider registries.
  • Self-hosted — run your own private registry.

Example

Example · bash
# Search Docker Hub from the command line
docker search postgres

# Pull an official image (from Docker Hub by default)
docker pull nginx:1.27-alpine

# Pull from a different registry by including its host
docker pull ghcr.io/acme/api:2.1

When to use it

  • A developer pulls the official postgres:16-alpine image from Docker Hub instead of building a database image from scratch.
  • A company hosts a private registry on AWS ECR so CI/CD pipelines push proprietary application images without exposing them publicly.
  • A team mirrors frequently used public images to an internal registry to avoid Docker Hub rate limits during large-scale CI runs.

More examples

Search Docker Hub for an image

Searches Docker Hub for Nginx images and then pulls the lightweight Alpine variant.

Example · bash
docker search nginx --limit 5
docker pull nginx:alpine

Log in to Docker Hub

Authenticates to Docker Hub; using --password-stdin avoids the password appearing in shell history.

Example · bash
docker login
# Or with flags for scripted use:
docker login -u myusername --password-stdin <<< "$DOCKER_PAT"

Show image full registry path

Shows that Docker Hub pull shorthand expands to docker.io/library/<image> internally.

Example · bash
# Short form (Docker Hub implied)
docker pull nginx:alpine

# Equivalent full form
docker pull docker.io/library/nginx:alpine

Discussion

  • Be the first to comment on this lesson.