Learn how to push and pull images to Docker Hub, GHCR, and private registries, apply tagging conventions, and scan images for vulnerabilities.
Registries and Image Management
An image built on your laptop is only useful if you can share it. Registries are the distribution mechanism for Docker images - they store images, manage versions through tags, and control access. Mastering registries is essential for any team workflow or CI/CD pipeline.
Types of Registries
Docker Hub
Docker Hub is the default registry. When you run docker pull nginx, Docker looks for the image at docker.io/library/nginx.
Creating a Docker Hub account
- Sign up at hub.docker.com.
- Create a repository (public or private).
Logging in
Always use access tokens (created at hub.docker.com → Account Settings → Security) instead of your account password. Access tokens can be scoped and revoked individually.
Pushing an image to Docker Hub
Images must be tagged with your Docker Hub username as the namespace before pushing:
Or push all tags at once:
GitHub Container Registry (GHCR)
GHCR is tightly integrated with GitHub Actions and GitHub's permission model. Images are scoped to a GitHub user or organisation.
Authentication
Pushing to GHCR
Making a GHCR image public
By default, packages inherit the visibility of the repository they are linked to. You can change this at github.com → Your profile → Packages → <package> → Package settings.
Private Registries
Self-hosted Docker Registry
Run the official registry image to host your own:
Push and pull from it:
For production use, add TLS and authentication - an unauthenticated HTTP registry is only suitable for trusted local networks.
AWS ECR
Pulling Images
Tagging Conventions
Good tagging is critical for production deployments. Inconsistent tags make it hard to know what version is running, roll back, or reproduce issues.
Common patterns
Recommended production tagging strategy
Tag with both the full semver and the git SHA so you can always trace an image back to the exact commit:
Why latest is an antipattern in production
latestis mutable - today'slatestand tomorrow'slatestmay be different images.- Pulling
latestin production means you may get an untested version silently. - It makes rollbacks ambiguous - you cannot easily deploy "the previous latest."
Use specific version tags in production manifests. Reserve latest for pointing developers to the most recent development image.
Inspecting Remote Images
You can inspect an image's metadata without pulling the full image:
Image Scanning with Docker Scout
Docker Scout is Docker's built-in vulnerability scanner. It analyses image layers against known CVE databases.
Sample docker scout quickview output:
Alternative scanners
Integrate scanning into your CI pipeline so every image push is checked for vulnerabilities before deployment.
Logging Out
Credentials are stored in ~/.docker/config.json. In CI environments, always log out after pushing to prevent credential leakage.
Working with Multi-Architecture Images
Modern Docker supports building and pushing images for multiple CPU architectures (amd64, arm64, arm/v7) using Docker Buildx and manifest lists.
When a user pulls myusername/my-app:1.0.0, Docker automatically selects the image variant that matches their platform (OS, CPU architecture, and variant - e.g. linux/amd64 vs linux/arm64 vs linux/arm/v7). This is how official Docker Hub images that publish a multi-platform manifest work - not every official image does.
Registry Best Practices
- Use access tokens, not passwords - Tokens can be scoped and rotated.
- Pin to specific tags in production - Never deploy
latestto production. - Use immutable tags (SHAs or exact versions) - Makes rollbacks and auditing reliable.
- Scan images before deployment - Integrate Docker Scout or Trivy into CI.
- Set up retention policies - Registries grow; delete old images and untagged digests automatically.
- Limit registry access - Use private repositories for proprietary applications.
- Sign images - Use Docker Content Trust or sigstore/cosign to cryptographically verify image integrity.