SkillSprout
Chapter 2 · Lesson 1
Intermediate
2 min read

Distribute Images with a Registry

Overview

A registry stores image layers and serves them to Docker clients. Docker Hub is a public registry and can also host private repositories. A private company registry might enforce access policies and internal networking.

Detailed Notes

Build, tag and push

bash
docker build -t my-app:1.0 .
docker login
docker tag my-app:1.0 username/my-app:1.0
docker push username/my-app:1.0

docker login authenticates the local Docker CLI. The first login stores credentials through Docker Desktop or a credential helper; do not print passwords in scripts.

docker tag does not copy image content immediately. It creates another local reference for the same image ID.

docker push uploads missing image layers and the manifest. A server can now pull:

bash
docker pull username/my-app:1.0
docker run --rm username/my-app:1.0

Versioning example

ReferenceMeaning
my-app:latestMutable convenience pointer
my-app:1.0.2Release version
my-app:sha-3ac12fTraceable source revision
my-app@sha256:...Exact immutable image digest

Production systems should record the digest or build commit alongside the human-readable tag.

Image registry workflow
Architecture
Source commitLocal imageRegistryProductiondocker buildtag + pushpull
Key point. A CI job builds the committed source.

Images move from source code through CI and into runtime environments.

Common Interview Questions

Finished this lesson?

0 of 27 lessons done · 0% of the course