---
title: "Managing Image Promotion Across Dev, Staging, and Prod"
date: "2026-11-18T17:15:00+07:00"
description: "Architecting image promotion pipelines: why you should re-tag images instead of re-building across dev, staging, and production environments."
author: "AI Assistant"
image: "https://blog.redlinesoft.net/images/post/managing-image-promotion-dev-staging-prod.jpg"
alt: "Diagram illustrating image promotion workflow copying verified image digests across development, staging, and production registries"
tags: ['docker', 'cicd', 'devops', 'release-management']
---

A common anti-pattern in software release pipelines is re-building container images from source code for each environment—once for Development, once for Staging, and once more for Production.

Re-building images across environments introduces risks: upstream base packages may receive patch updates between builds, compiler outputs may vary, and testing performed in Staging no longer guarantees that the production image is bit-for-bit identical.

The Golden Rule of Container Release Management is: **Build Once, Promote Everywhere**.

In this guide, we will design an enterprise **Image Promotion Pipeline**, examine environment isolation architectures, and automate image promotion using Skopeo and registry re-tagging.

## "Build Once, Promote Everywhere" Philosophy

```text
WRONG (Re-building per environment):
  [Git Commit] ──> Build Dev Image ──────> Deployed to Dev
  [Git Commit] ──> Build Staging Image ──> Tested in Staging (Different Digest!)
  [Git Commit] ──> Build Prod Image ─────> Deployed to Prod (Risk of new bugs!)

RIGHT (Image Promotion Pipeline):
  [Git Commit] ──> Build ONE Image (Digest: sha256:7f8a91...)
                        │
                        ├──> Promoted to Dev (myapp:dev-sha7f8a)
                        │
                        ├──> Passed QA? Re-tag / Copy to Staging (myapp:staging-v1.2.0-rc1)
                        │
                        └──> Approved? Re-tag / Copy to Prod (myapp:v1.2.0)
                        (Exact same SHA-256 digest tested in QA runs in Production!)
```

## Environment Registry Topologies

Organizations structure promotion registries using one of two models:

### Model A: Single Registry with Namespace Segregation
All environments share a single registry instance (e.g. Harbor or ECR) with access controlled by project namespaces:
- `registry.company.com/dev/payment-service:sha-12345`
- `registry.company.com/staging/payment-service:v1.2.0-rc1`
- `registry.company.com/prod/payment-service:v1.2.0`

### Model B: Isolated Registries per Cloud Environment (Recommended)
Separate registry instances for absolute physical and IAM network isolation:
- Dev Registry: `dev-registry.company.internal`
- Staging Registry: `staging-registry.company.internal`
- Prod Registry: `prod-registry.company.internal`

## Implementing Image Promotion with Skopeo

When promoting an image from Staging to Production across isolated registries, use **Skopeo** to transfer the exact OCI manifest index and layer blobs without downloading files to a local build machine:

```bash
#!/usr/bin/env bash
set -euo pipefail

DIGEST="sha256:7f8a91b2c3d4e5f67890..."
PROD_VERSION="v1.2.0"

STAGING_REGISTRY="staging-registry.company.internal"
PROD_REGISTRY="prod-registry.company.internal"

echo "Promoting Image Digest $DIGEST to Production as $PROD_VERSION..."

skopeo copy \
  --all \
  --src-creds "${STAGING_USER}:${STAGING_PASS}" \
  --dest-creds "${PROD_USER}:${PROD_PASS}" \
  "docker://${STAGING_REGISTRY}/apps/payment-service@${DIGEST}" \
  "docker://${PROD_REGISTRY}/apps/payment-service:${PROD_VERSION}"

echo "Promotion Successful!"
```

## Automated GitHub Actions Promotion Workflow

Below is a GitHub Actions workflow that triggers image promotion to Production only when an official Release tag is created:

```yaml
name: Promote Staging Image to Production

on:
  release:
    types: [published]

jobs:
  promote:
    runs-on: ubuntu-latest
    steps:
      - name: Install Skopeo
        run: sudo apt-get update && sudo apt-get install -y skopeo

      - name: Copy Verified Staging Image to Production Registry
        run: |
          RELEASE_TAG="${{ github.event.release.tag_name }}"
          
          # Copy exact multi-arch image from Staging to Production
          skopeo copy \
            --all \
            --src-creds "${{ secrets.STAGING_REGISTRY_USER }}:${{ secrets.STAGING_REGISTRY_TOKEN }}" \
            --dest-creds "${{ secrets.PROD_REGISTRY_USER }}:${{ secrets.PROD_REGISTRY_TOKEN }}" \
            docker://staging-registry.myorg.com/app/service:${{ github.sha }} \
            docker://prod-registry.myorg.com/app/service:${RELEASE_TAG}
```

## Injecting Environment Configuration at Runtime

If the exact same container image runs in Dev, Staging, and Production, how do you handle environment-specific settings (such as database URLs or API keys)?

**Rule**: Never bake environment configuration into container image layers. Inject configuration at runtime using:
- Environment Variables (`ENV` passed via Kubernetes ConfigMaps / Secrets).
- External Configuration Providers (HashiCorp Vault, AWS Secrets Manager).
- Mounted Configuration Files (`/etc/myapp/config.yaml`).

## Summary Checklist

| Principle | Best Practice |
| :--- | :--- |
| **Build Frequency** | Build image ONCE per Git commit SHA. |
| **Promotion Method** | Re-tag or copy OCI manifests via Skopeo (never re-run `docker build`). |
| **Verification** | Verify that Staging digest matches Production digest bit-for-bit. |
| **Configuration** | Decouple code from environment config using runtime environment variables. |

Adopting an automated image promotion pipeline guarantees that software running in production is 100% identical to the code vetted during QA and staging testing.
