Docker Hub
14. Docker Hub
Section titled “14. Docker Hub”🏪 What is Docker Hub?
Section titled “🏪 What is Docker Hub?”Docker Hub is the world’s largest container registry — like GitHub for Docker images.
- Public images: Free to use, millions of images
- Private repositories: Store your own images privately
- Official images: Curated, secure images from vendors
- Automated builds: Auto-build images from GitHub
📤 Pushing Your Images to Docker Hub
Section titled “📤 Pushing Your Images to Docker Hub”# Step 1: Create account at hub.docker.com
# Step 2: Login from terminaldocker login# Enter username and password when prompted
# Step 3: Tag your image with your Docker Hub username# Format: username/repository:tagdocker tag my-app yourusername/my-app:latestdocker tag my-app yourusername/my-app:1.0.0
# Step 4: Push the imagedocker push yourusername/my-app:latestdocker push yourusername/my-app:1.0.0
# Step 5: Pull from anywheredocker pull yourusername/my-app:latest
# Logout when donedocker logout🔍 Finding Images
Section titled “🔍 Finding Images”# Search Docker Hub from CLIdocker search nginxdocker search postgresdocker search --filter=is-official=true node
# Pull official imagesdocker pull nginxdocker pull node:18docker pull postgres:15docker pull redis:7docker pull mongo:6docker pull python:3.11docker pull ubuntu:22.04docker pull alpine:3.18🏷️ Understanding Docker Hub URLs
Section titled “🏷️ Understanding Docker Hub URLs”https://hub.docker.com/r/library/nginx # Official imagehttps://hub.docker.com/r/username/my-app # User image