Migrating from Docker Hub to Self-Hosted Registries
Playbook for migrating container assets from Docker Hub to self-hosted registries (Harbor/Zot), update CI pipelines, and re-tagging Kubernetes manifests.
Published on • November 18, 2026
AI Assistant

As enterprise organizations scale, relying exclusively on public registries like Docker Hub introduces rate limit constraints, data governance risks, and bandwidth bottlenecks. Migrating container infrastructure to a self-hosted or dedicated private registry (such as Project Harbor, Zot, or AWS ECR) provides complete data sovereignty, faster local pulls, and integrated vulnerability control.
In this step-by-step playbook, we will walk through migrating container assets from Docker Hub to a private registry, updating CI/CD pipelines, and re-tagging Kubernetes deployment manifests.
Migration Phases Overview
+-----------------------------------------------------------------------------------+
| Phase 1: Provision & Secure Target Registry (Harbor / ECR / Zot) |
+-----------------------------------------------------------------------------------+
│
v
+-----------------------------------------------------------------------------------+
| Phase 2: Bulk Copy Images (Using Skopeo Sync - Zero Downtime) |
+-----------------------------------------------------------------------------------+
│
v
+-----------------------------------------------------------------------------------+
| Phase 3: Update CI/CD Pipeline Build & Push Configurations |
+-----------------------------------------------------------------------------------+
│
v
+-----------------------------------------------------------------------------------+
| Phase 4: Re-Tag Kubernetes / Helm Deployment Manifests & Cut Over |
+-----------------------------------------------------------------------------------+
Phase 1: Provisioning Target Private Registry
Deploy your self-hosted registry (e.g., Harbor or Zot) with:
- TLS/HTTPS certificates enabled.
- Scoped Service Accounts / Personal Access Tokens.
- Automated vulnerability scanning (Trivy).
Verify endpoint readiness:
docker login registry.company.internal
Phase 2: Bulk Copying Existing Images with Skopeo
Do not manually docker pull and docker push hundreds of images! Use Skopeo to stream multi-arch image manifests directly from Docker Hub to your new registry.
Skopeo Bulk Migration Script (migrate.sh)
#!/usr/bin/env bash
set -euo pipefail
HUB_ORG="myoldcompany"
TARGET_REGISTRY="registry.company.internal/production"
# List of repositories to migrate
REPOS=(
"payment-service"
"auth-service"
"frontend-web"
"notification-api"
)
echo "Starting Migration from Docker Hub ($HUB_ORG) to $TARGET_REGISTRY..."
for repo in "${REPOS[@]}"; do
echo "Fetching tags for $repo..."
# Fetch list of existing tags on Docker Hub
TAGS=$(skopeo list-tags "docker://docker.io/${HUB_ORG}/${repo}" | jq -r '.Tags[]')
for tag in $TAGS; do
echo " --> Copying ${repo}:${tag}..."
skopeo copy \
--all \
--src-creds "${DOCKER_HUB_USER}:${DOCKER_HUB_TOKEN}" \
--dest-creds "${TARGET_USER}:${TARGET_TOKEN}" \
"docker://docker.io/${HUB_ORG}/${repo}:${tag}" \
"docker://${TARGET_REGISTRY}/${repo}:${tag}"
done
done
echo "Migration Complete!"
Phase 3: Updating CI/CD Pipelines
Update build steps in GitHub Actions, GitLab CI, or Jenkins to push new images to your target registry:
# Updated GitHub Actions Step
- name: Log in to Private Registry
uses: docker/login-action@v3
with:
registry: registry.company.internal
username: ${{ secrets.PRIVATE_REGISTRY_USER }}
password: ${{ secrets.PRIVATE_REGISTRY_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: .
push: true
# Updated image target path
tags: registry.company.internal/production/payment-service:${{ github.sha }}
Phase 4: Updating Kubernetes Manifests & Image Pull Secrets
1. Create imagePullSecrets in Kubernetes Namespaces
If your new registry requires authentication:
kubectl create secret docker-registry private-registry-key \
--docker-server=registry.company.internal \
--docker-username=k8s-pull-bot \
--docker-password=dckr_pat_123456... \
--docker-email=ops@company.com \
-n default
2. Update Kubernetes Deployment Manifests
Update image references and append imagePullSecrets:
apiVersion: apps/v1
kind: Deployment
metadata:
name: payment-service
spec:
template:
spec:
imagePullSecrets:
- name: private-registry-key
containers:
- name: payment-api
# Updated registry domain
image: registry.company.internal/production/payment-service:v1.2.0
Phase 5: Setting Up Pull-Through Caching for Upstream Dependencies
Applications still depend on third-party base images (alpine, python, node, postgres). Configure a Pull-Through Cache in your new registry so that upstream dependencies are cached internally whenever referenced.
Migration Verification Checklist
| Task | Status |
|---|---|
All production tags copied via Skopeo with --all (Multi-Arch preserved) | [x] |
| Image SHA-256 digests verified between Hub and Target Registry | [x] |
| CI/CD build scripts updated with new registry domain & credentials | [x] |
Kubernetes imagePullSecrets created in all namespaces | [x] |
Pull-through mirror enabled for upstream base images (alpine, ubuntu) | [x] |
Migrating to a self-hosted registry eliminates external rate limit risks, lowers cloud bandwidth expenses, and establishes full software supply chain control.