Guide Docker Beginner

5. Images and Registries

Work with image names, tags, digests, pulls, and local metadata.

1 min read

Image References

An image reference can include a registry, repository, and tag. For example, nginx:alpine identifies the nginx repository with the alpine tag on the default registry.

A tag is a movable label. A digest identifies specific image content. Use an approved digest when a release must reference an exact artifact.

Inspect an Image

docker pull nginx:alpine
docker image ls
docker image inspect nginx:alpine
docker image history nginx:alpine

The history helps explain how the image was assembled. It is not a substitute for scanning or reviewing the source Dockerfile.

Retag Locally

docker tag nginx:alpine docker-course-web:demo
docker image inspect docker-course-web:demo

Tagging creates another reference to the image; it does not rebuild it. Pushing requires a registry repository you can write to and appropriate authentication.

Common Mistakes

  • Assuming latest means the newest or most secure image.
  • Rebuilding separately in each deployment environment instead of promoting a tested artifact.
  • Assuming an image supports every CPU architecture.

Practice

Compare the image IDs of the original and local tag. Explain why their names differ but their content is shared.

Quick Interview Answer

Registries distribute images. Tags are convenient labels, while digests identify content precisely.


Previous: 4. Container Lifecycle | Next: 6. Dockerfile Basics

Add More Questions to This Guide

Know a question that should be here? Share it and help the community!

Open Google Form