Keyboard Shortcuts N Next post
P Previous post
S Save / unsave
R Read aloud
T Toggle theme
/ Focus search
Esc Close panels
🔥
Ready to read...
Docker Docker & Containers: From Zero to Production Docker Hub Docker Images Module 2 — Docker Images

Tagging and Pushing Images to Docker Hub and Private Registries

Reviewed & accurate
AI Summary

What You'll Learn

Beginner

  • How to tag images properly
  • How to push images to Docker Hub
  • How to use private registries

Image Naming Convention

Image namebash
[registry/]username/repo:tag

# Examples:
nginx                           # Docker Hub official
myuser/myapp:v1.0              # Docker Hub user repo
ghcr.io/org/repo:v1.0          # GitHub Container Registry

Tagging Images

Terminalbash
docker tag myapp:latest myuser/myapp:v1.0
docker tag myapp:v1.0 myuser/myapp:latest

Pushing to Docker Hub

Create an account at hub.docker.com
Log in: docker login
Tag: docker tag myapp:latest myuser/myapp:v1.0
Push: docker push myuser/myapp:v1.0

Pushing to GitHub Container Registry

Create a GitHub PAT with write:packages scope
Log in: echo $TOKEN | docker login ghcr.io -u USERNAME --password-stdin
Tag: docker tag myapp:latest ghcr.io/myuser/myapp:v1.0
Push: docker push ghcr.io/myuser/myapp:v1.0

Practical Exercise

Build an image: docker build -t myapp:1.0 .
Log in to Docker Hub: docker login
Tag: docker tag myapp:1.0 YOUR_USERNAME/myapp:1.0
Push: docker push YOUR_USERNAME/myapp:1.0
Pull from another machine

Key Takeaways

  • Image name format: [registry/]username/repo:tag
  • docker tag source target creates a new tag.
  • docker login authenticates with the registry.
  • docker push uploads; docker pull downloads.
  • Use semantic versioning + git SHA. Avoid latest.
Previously: Lesson 14 covered multi-stage builds.
Today: You learned: Tag, push, and share Docker images.
Next: Module 2 complete! Module 3 begins with lesson 16.
Test Your Knowledge
How did you find this?

Comments

Join the discussion! Sign in with your Google or Blogger account, or comment as Anonymous - no account needed. For quick questions, also reach me on Telegram @cytestch.

Comments