Script Valley
Docker: Complete Course
Building Docker Images with DockerfileLesson 2.5

Pushing Docker images to Docker Hub and private registries

docker login, docker tag, docker push, Docker Hub repository, ECR, GHCR, image naming convention, registry authentication

Sharing Images Across Machines and Teams

Docker image push and pull flow

An image on your laptop is useless in production. You push it to a registry — a remote store for images — and production servers pull it from there.

Push to Docker Hub

# Login (one-time)
docker login

# Tag the image: username/repository:tag
docker tag myapp:latest yourname/myapp:1.0.0
docker tag myapp:latest yourname/myapp:latest

# Push both tags
docker push yourname/myapp:1.0.0
docker push yourname/myapp:latest

Push to GitHub Container Registry (GHCR)

# Authenticate with a Personal Access Token
echo $GITHUB_TOKEN | docker login ghcr.io -u USERNAME --password-stdin

# Tag using the ghcr.io prefix
docker tag myapp ghcr.io/your-org/myapp:1.0.0
docker push ghcr.io/your-org/myapp:1.0.0

Naming Convention

Image names follow the pattern: registry/namespace/name:tag. Docker Hub is the default registry, so yourname/myapp implicitly means docker.io/yourname/myapp. Always tag with a specific version — never rely solely on latest in production, as it is mutable and can cause silent regressions.