Docker Registry Installation
Step-by-step installation guide for deploying a Docker registry in your Kubernetes homelab cluster.
Prerequisites
- Kubernetes cluster running (v1.24+)
- MetalLB load balancer installed and configured
- Local-path storage provisioner installed
kubectlconfigured to access your cluster- ArgoCD installed (optional, for GitOps deployment)
Installation Methods
Method 1: Manual Installation with kubectl
Step 1: Clone the Repository
Step 2: Navigate to Registry Directory
Step 3: Review Configuration
Check the kustomization.yaml to see what resources will be deployed:
Expected resources: - namespace.yaml - pvc.yaml (PersistentVolumeClaim) - configmap.yaml (Registry configuration) - deployment.yaml (Registry pod) - service.yaml (LoadBalancer service)
Step 4: Deploy Registry
Step 5: Verify Deployment
# Wait for pod to be ready
kubectl wait --for=condition=ready pod -l app=docker-registry \
-n docker-registry --timeout=300s
# Check pod status
kubectl get pods -n docker-registry
# Check service and external IP
kubectl get svc -n docker-registry
# View registry logs
kubectl logs -f deployment/docker-registry -n docker-registry
Step 6: Get Registry IP
export REGISTRY_IP=$(kubectl get svc docker-registry -n docker-registry \
-o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo "Registry accessible at: http://$REGISTRY_IP:5000"
Expected output:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
docker-registry LoadBalancer 10.96.123.45 192.168.1.248 5000:30000/TCP 2m
Method 2: GitOps Deployment with ArgoCD
Step 1: Push Configuration to Git
git add applications/docker-registry/
git commit -m "Add Docker registry configuration"
git push origin main
Step 2: Create ArgoCD Application
The ArgoCD application manifest is already configured in cicd/argocd/applications/docker-registry-app.yaml.
Verify the application:
Step 3: Sync via ArgoCD UI
- Open ArgoCD:
http://192.168.1.*** - Login with credentials
- Find the
docker-registryapplication - Click "Sync" to deploy
Step 4: Verify via ArgoCD
# Check application status
argocd app get docker-registry
# Or view in cluster
kubectl get application docker-registry -n argocd
Post-Installation Configuration
Configure Docker to Use Insecure Registry
On Linux
Add your registry IP:
Restart Docker:
Verify configuration:
On macOS (Docker Desktop)
- Open Docker Desktop
- Go to Settings → Docker Engine
- Add to JSON configuration:
- Click "Apply & Restart"
Test Registry Connectivity
# Test with curl
curl http://$REGISTRY_IP:5000/v2/
# Expected response:
# {}
# List repositories (should be empty initially)
curl http://$REGISTRY_IP:5000/v2/_catalog
# Expected response:
# {"repositories":[]}
Push a Test Image
# Pull a small test image
docker pull alpine:latest
# Tag for registry
docker tag alpine:latest $REGISTRY_IP:5000/test-image:latest
# Push to registry
docker push $REGISTRY_IP:5000/test-image:latest
# Verify image is in registry
curl http://$REGISTRY_IP:5000/v2/_catalog
curl http://$REGISTRY_IP:5000/v2/test-image/tags/list
Verification Checklist
- [ ] Pod is running:
kubectl get pods -n docker-registry - [ ] Service has external IP:
kubectl get svc -n docker-registry - [ ] PVC is bound:
kubectl get pvc -n docker-registry - [ ] Registry responds to API:
curl http://$REGISTRY_IP:5000/v2/ - [ ] Docker can push images:
docker push $REGISTRY_IP:5000/test-image - [ ] Images are persisted: Restart pod and verify images remain
Troubleshooting Installation
Pod Stuck in Pending
# Check pod events
kubectl describe pod -n docker-registry -l app=docker-registry
# Common issues:
# - PVC not bound: Check storage class
# - Node not schedulable: Check node resources
# - Image pull errors: Check network connectivity
PVC Not Binding
# Check PVC status
kubectl get pvc -n docker-registry -o yaml
# Verify storage class exists
kubectl get storageclass local-path
# Check local-path provisioner
kubectl get pods -n local-path-storage
No External IP Assigned
# Check MetalLB status
kubectl get pods -n metallb-system
# Check IP pool
kubectl get ipaddresspool -n metallb-system
# Verify IP pool range
kubectl get ipaddresspool -n metallb-system -o yaml
Registry Not Responding
# Check pod logs
kubectl logs -n docker-registry deployment/docker-registry
# Check configmap
kubectl get configmap -n docker-registry registry-config -o yaml
# Verify registry configuration
kubectl exec -n docker-registry deployment/docker-registry -- \
cat /etc/docker/registry/config.yml
Next Steps
After successful installation:
- Configure registry access
- Build and push custom images
- Update CI/CD pipelines to use registry
- Set up automated backups
Rollback
If you need to remove the registry:
# Remove deployment
kubectl delete -k applications/docker-registry/
# Or delete namespace (includes everything)
kubectl delete namespace docker-registry
# ⚠️ Warning: This will delete all registry data!
For more information, see the main documentation.