Docker Registries

Loading concept...

πŸͺ Docker Registries: Your Image Supermarket

Imagine you baked the most amazing cake. Now you want to share it with friends or keep it safe for later. Where do you store it? In a special bakery fridge, of course! Docker registries are exactly that β€” special storage places for your container images!


🎯 What You’ll Learn

  • What Docker registries are and why they matter
  • How Docker Hub works (the biggest registry)
  • Public vs Private registries
  • How to log in and authenticate

πŸ“¦ What is a Docker Registry?

Think of a Docker registry like a huge library for container images.

πŸͺ Registry = Storage place for Docker images
πŸ“¦ Image    = Your app packaged and ready to run

Just like a library stores books, a registry stores images. When you need an image, you β€œcheck it out” (pull). When you create one, you β€œdonate it” (push).

graph TD A[Your Computer] -->|push| B[Registry] B -->|pull| C[Any Other Computer] B -->|pull| D[Server] B -->|pull| E[Cloud]

Real-Life Example

When you run:

docker pull nginx

Docker goes to a registry, finds the nginx image, and downloads it to your computer. Magic! ✨


🌐 Docker Hub: The Main Library

Docker Hub is the default and biggest Docker registry. It’s like the main public library everyone knows.

Quick Facts

Feature What It Means
πŸ†“ Free tier Yes! Anyone can use it
πŸ“Š Millions of images nginx, python, node, etc.
πŸ”— Official images Verified by Docker team
🏠 Address hub.docker.com

How Docker Hub Works

When you type a simple image name like nginx, Docker automatically looks in Docker Hub:

# These two commands do the same thing!
docker pull nginx
docker pull docker.io/library/nginx

It’s like saying β€œGet me that book” β€” the librarian knows exactly where to look!

Finding Images on Docker Hub

  1. Official Images β€” Made by Docker team (blue badge βœ“)
  2. Verified Publisher β€” From trusted companies
  3. Community Images β€” Made by regular users
πŸ† Official:    nginx, mysql, redis
🏒 Publisher:   microsoft/dotnet
πŸ‘€ Community:   someuser/myapp

πŸ”“ Public vs Private Registries

Here’s the big question: Should everyone see your images?

Public Registries πŸ“’

Like a public library β€” anyone can browse and borrow.

βœ… Great for:
  - Open source projects
  - Sharing with the world
  - Learning from others

❌ Not good for:
  - Secret company code
  - Private applications
  - Sensitive data

Private Registries πŸ”

Like your personal safe β€” only you (and people you trust) can access.

βœ… Great for:
  - Company applications
  - Secret projects
  - Paid software

Popular options:
  - Docker Hub (private repos)
  - AWS ECR
  - Google Container Registry
  - Azure Container Registry
  - Self-hosted (Harbor, Nexus)

Quick Comparison

graph LR A[Your Image] --> B{Public or Private?} B -->|Public| C[Everyone can pull] B -->|Private| D[Only authorized users]
Type Who Can See? Cost Example
Public Everyone Free Docker Hub public
Private Only you/team Often paid AWS ECR, private repos

πŸ”‘ Registry Authentication

To push images or access private registries, you need to prove who you are. This is called authentication.

The docker login Command

# Log into Docker Hub
docker login

# You'll see:
# Username: yourname
# Password: ********
# Login Succeeded βœ“

That’s it! Now Docker remembers you.

Logging Into Other Registries

Different registries have different addresses:

# Docker Hub (default)
docker login

# AWS ECR
docker login <account>.dkr.ecr.<region>.amazonaws.com

# Google Container Registry
docker login gcr.io

# GitHub Container Registry
docker login ghcr.io

How Authentication Works

graph TD A[You type docker login] --> B[Enter username + password] B --> C[Registry checks credentials] C --> D{Valid?} D -->|Yes| E[Token saved locally] D -->|No| F[Access denied] E --> G[Now you can push/pull!]

Where Credentials Are Stored

After logging in, Docker saves your credentials safely:

πŸ“ ~/.docker/config.json

This file keeps your login info so you don’t need to type it every time.

Logging Out

Done working? Always log out on shared computers:

docker logout

πŸŽͺ Putting It All Together

Let’s see the complete flow:

Step 1: Log In

docker login
# Enter your Docker Hub credentials

Step 2: Tag Your Image

docker tag myapp:latest yourname/myapp:v1

Step 3: Push to Registry

docker push yourname/myapp:v1

Step 4: Anyone Can Pull (if public)

docker pull yourname/myapp:v1

🧠 Key Takeaways

Concept One-Line Summary
Registry Storage place for Docker images
Docker Hub The default, biggest public registry
Public Anyone can see and download
Private Only authorized users can access
docker login Prove who you are to push/pull

πŸ’‘ Pro Tips

  1. Always use official images when possible β€” they’re safer!
  2. Don’t put secrets in images β€” use environment variables instead
  3. Tag your images properly β€” v1.0.0 is better than latest
  4. Log out on shared computers β€” protect your account!

πŸš€ You Did It!

Now you understand Docker registries! You know:

  • βœ… What registries are (image storage)
  • βœ… How Docker Hub works (the main library)
  • βœ… Public vs private (who can see?)
  • βœ… Authentication (proving who you are)

Think of it this way: registries are like cloud storage for your apps. Push to share, pull to use. Simple! πŸŽ‰

Loading story...

No Story Available

This concept doesn't have a story yet.

Story Preview

Story - Premium Content

Please sign in to view this concept and start learning.

Upgrade to Premium to unlock full access to all content.

Interactive Preview

Interactive - Premium Content

Please sign in to view this concept and start learning.

Upgrade to Premium to unlock full access to all content.

No Interactive Content

This concept doesn't have interactive content yet.

Cheatsheet Preview

Cheatsheet - Premium Content

Please sign in to view this concept and start learning.

Upgrade to Premium to unlock full access to all content.

No Cheatsheet Available

This concept doesn't have a cheatsheet yet.

Quiz Preview

Quiz - Premium Content

Please sign in to view this concept and start learning.

Upgrade to Premium to unlock full access to all content.

No Quiz Available

This concept doesn't have a quiz yet.