What is Docker Hub?
Docker Hub is the world's largest public container registry where developers store and share Docker images. It is the default registry Docker uses when you run docker pull.
Think of Docker Hub like GitHub but for Docker images.
Docker Hub Features
- Free public repositories for open-source images
- Official images for Nginx, MySQL, PHP, Node.js, Ubuntu
- Private repositories (limited on free plan)
- Automated builds from GitHub/Bitbucket
- Image versioning with tags
Push Your Image to Docker Hub
Step 1: Create a Docker Hub Account
Visit https://hub.docker.com and create a free account.
Step 2: Login from Terminal
docker login
Enter your Docker Hub username and password.
Step 3: Build and Tag Your Image
docker build -t my-app .
docker tag my-app yourusername/my-app:v1.0
Step 4: Push Image to Docker Hub
docker push yourusername/my-app:v1.0Step 5: Pull Image on Another Machine
docker pull yourusername/my-app:v1.0
docker run -d -p 8080:80 yourusername/my-app:v1.0
Using Official Images from Docker Hub
docker pull nginx:latest
docker pull mysql:8.0
docker pull php:8.2-apache
docker pull node:18-alpine
docker pull ubuntu:22.04
Searching Images on Docker Hub
docker search nginx
Output:
NAME DESCRIPTION STARS
nginx Official build of Nginx 18000+
bitnami/nginx Bitnami nginx Docker image 150+
Setting Up a Private Registry
# Run local private registry on port 5000
docker run -d -p 5000:5000 --name registry registry:2
# Tag image for private registry
docker tag my-app localhost:5000/my-app
# Push to private registry
docker push localhost:5000/my-app
# Pull from private registry
docker pull localhost:5000/my-appDocker Hub vs Private Registry
| Feature | Docker Hub | Private Registry |
|---|---|---|
| Cost | Free (limited private) | Self-hosted or paid |
| Access | Public/Private | Private only |
| Use Case | Open source, sharing | Enterprise, internal |
| Examples | hub.docker.com | AWS ECR, GCR, Azure ACR |
Summary
- Docker Hub is the default public registry for Docker images
- Use
docker login,docker tag, anddocker pushto publish your images - Pull official images like Nginx, MySQL, PHP directly from Docker Hub
- For enterprise use, set up a private registry with AWS ECR or self-hosted
0
likes
Your Feedback
Help us improve by sharing your thoughts
Online Learner helps developers master programming, database concepts, interview preparation, and real-world implementation through structured learning paths.
Quick Links
© 2023 - 2026 OnlineLearner.in | All Rights Reserved.
