Docker

Article & Tutorial

Docker Registry Explained: Tag, Login, Push and Pull Images

Learn Docker registries, image tags, Docker Hub, private registries, login, push, pull, naming rules, CI/CD usage, security, and best practices.

Docker registry image tagging, push and pull workflow
Docker registry image tagging, push and pull workflow
Contents

Docker Registry Explained

A Docker registry stores and distributes container images. This guide explains Docker Hub, private registries, image names, tags, login, push, pull, CI/CD usage, and security best practices.

What is a Docker registry?

A registry is a place where Docker images are stored. Developers and CI/CD pipelines push images to a registry, and servers or Kubernetes clusters pull images from it.

Image naming format

registry.example.com/team/app:v1.0.0 nginx:1.27 myuser/myapp:latest

Pull an image

docker pull nginx:latest

Build and tag an image

docker build -t myapp:1.0 . docker tag myapp:1.0 myuser/myapp:1.0

Login and push

docker login docker push myuser/myapp:1.0

Pull and run

docker pull myuser/myapp:1.0 docker run -d -p 3000:3000 myuser/myapp:1.0

Common registry options

  • Docker Hub
  • GitLab Container Registry
  • GitHub Container Registry
  • AWS Elastic Container Registry
  • Azure Container Registry
  • Google Artifact Registry
  • Self-hosted private registry

CI/CD usage example

docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" . docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA"

Tagging strategy

  • Tag — Use
  • latest — Convenient but risky for production.
  • Commit SHA — Good for traceability.
  • Semantic version — Good for releases, such as v1.2.0 .
  • Environment tag — Useful for dev/staging pointers.

Common mistakes

  • Using only latest in production.
  • Not scanning pushed images.
  • Pushing secrets inside images.
  • Using one shared registry account for everyone.
  • Not cleaning old images and tags.

Best practices

  • Use immutable tags for releases.
  • Use least-privilege registry tokens.
  • Scan images before deployment.
  • Document image naming standards.
  • Clean unused tags carefully.

Related Melochip guides

  • Docker Learning Path
  • GitLab Docker Build Pipeline
  • Artifact Repository Managers

Official references

  • Docker Hub repositories
  • docker image push reference

Tag names can change; digests identify content

A tag such as latest is mutable. For reproducible deployments, record or pin the tested image digest as well as its source revision. The command fetches a public example image; it is illustrative and has not been run on your system.

docker-diagnostics.sh
docker pull alpine:3.20
docker image inspect alpine:3.20 --format '{{json .RepoDigests}}'

Related Melochip guide: https://melochip.com/posts/docker-images-vs-containers-explained. Commands are illustrative and have not been independently executed.

Read the related Docker guide

Practical guidance and verification

A secure build-to-registry workflow

Build the image from a reviewed Dockerfile, apply an unambiguous repository name and version tag, scan the image and its dependencies, and authenticate to your approved registry with a short-lived identity where supported. Push the candidate image and verify its digest. A mutable tag such as latest can move between images, so deploying by immutable digest improves reproducibility.

Private registry permissions

Separate read-only pull credentials from publishing credentials. Avoid putting registry passwords in Dockerfiles, build arguments, shell history or CI logs. Use credential helpers or your CI platform's identity integration, configure repository retention policies, and document how compromised images are revoked. Registry access control alone does not establish that an image is safe.

Diagnose push and pull failures

For denied errors, confirm registry hostname, repository ownership, credentials, and push versus pull scopes. For manifest-not-found errors, confirm the exact tag and platform architecture. For certificate failures, correct trust configuration rather than disabling TLS verification. Inspect Docker image metadata and registry digest after the push; review the official Docker registry guidance at https://docs.docker.com/docker-hub/repos/.

Did this help?

Yes No

Join the discussion

0 Comments

Ask questions, add context, or share what worked.

Sign in to join the discussion

No comments yet. Start the discussion.

More from Melochip Editorial

Related articles

Stay in the loop. Get new Melochip articles

Receive Melochip article updates when new articles are available. Explicit opt-in only.

No pre-checked boxes. Unsubscribe support is part of the subscriber foundation.