CodeBlanks Logo Icon CodeBlanks

What is Docker Hub?

Learn that Docker Hub is a public registry.

What is Docker Hub?

A registry is the server where images are stored and shared. Docker Hub is the default public registry. If no registry is written in the image name, Docker Hub is assumed; if no user name is written, the official library repository is used:

nginx              = docker.io/library/nginx:latest
ali/api:1.0        = docker.io/ali/api:1.0
ghcr.io/ali/api    = GitHub Container Registry

For free accounts an hourly limit applies to anonymous pulls; logging in raises this limit.

Repositories and access

On Docker Hub each repository can be public or private. Anyone can pull from public repositories; only owners and team members can push. The tags in a repository can be seen in the web interface or with a script:

docker pull ali/api:1.0          # no login needed if public
docker search --limit 3 postgres # searching on Hub

Practice Pull from different registries

Write two commands: pull nginx:alpine with Docker Hub's full name (docker.io/library/...); then pull the ghcr.io/ali/api:1.0 image from the GitHub registry.

Starter code

terminal
# buraya yaz

Sample solution

terminal
docker pull docker.io/library/nginx:alpine
docker pull ghcr.io/ali/api:1.0

Expected output

alpine: Pulling from library/nginx
Status: Image is up to date for nginx:alpine
1.0: Pulling from ali/api
Status: Downloaded newer image for ghcr.io/ali/api:1.0

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What is the full equivalent of the image name redis?

  • docker.io/library/redis:latest Correct answer
  • redis.io/redis
  • docker.io/redis/redis
  • localhost/redis

Explanation: The registry, namespace and tag are completed with defaults.

2 Pull the image by its full name.

Question
docker pull ____/library/nginx:alpine
Answer
docker pull docker.io/library/nginx:alpine

Explanation: Docker Hub's registry address is docker.io.

3 Match.

Term Meaning
docker.io Docker Hub
library/ Official image namespace
ghcr.io GitHub registry
private depo Only authorized pull

All lessons in Beginner