Skip to main content
InfraGap.com Logo
Home
Getting Started
Core Concept What is a CDE? How It Works Benefits CDE Assessment Getting Started Guide CDEs for Startups
AI & Automation
AI Coding Assistants Agentic AI AI-Native IDEs Agentic Engineering AI Agent Orchestration AI Governance AI-Assisted Architecture Shift-Left AI LLMOps Autonomous Development AI/ML Workloads GPU Computing
Implementation
Architecture Patterns DevContainers Advanced DevContainers Language Quickstarts IDE Integration CI/CD Integration Platform Engineering Developer Portals Container Registry Multi-CDE Strategies Remote Dev Protocols Nix Environments
Operations
Performance Optimization High Availability & DR Disaster Recovery Monitoring Capacity Planning Multi-Cluster Development Troubleshooting Runbooks Ephemeral Environments
Security
Security Deep Dive Zero Trust Architecture Secrets Management Vulnerability Management Network Security IAM Guide Supply Chain Security Air-Gapped Environments AI Agent Security MicroVM Isolation Compliance Guide Governance
Planning
Pilot Program Design Stakeholder Communication Risk Management Migration Guide Cost Analysis FinOps GreenOps Vendor Evaluation Training Resources Developer Onboarding Team Structure DevEx Metrics Industry Guides
Resources
Tools Comparison CDE vs Alternatives Case Studies Lessons Learned Glossary FAQ

Container Registry and Image Management

Master container image management for Cloud Development Environments. Learn registry options, security scanning, image optimization, and lifecycle strategies for reliable, secure workspace provisioning.

Why Container Registries Matter for CDEs

Container registries are the backbone of Cloud Development Environment provisioning, providing the images that power every workspace your team creates.

Base Images for Workspaces

Every CDE workspace starts from a container image. Your registry stores these base images, pre-configured with languages, tools, and dependencies your developers need. When a developer spins up a new workspace, the CDE platform pulls the appropriate image from your registry in seconds.

Consistency Across Teams

When all developers pull from the same registry, everyone works in identical environments. No more "works on my machine" problems. A single source of truth for development images ensures your entire team operates with the same tools, versions, and configurations, eliminating environment drift.

Security Scanning and Compliance

Modern registries integrate with vulnerability scanners to detect CVEs, malware, and license violations before images reach production. Scan images at push time, gate deployments based on security policies, and maintain compliance with automated auditing. AI-powered scanning tools now prioritize vulnerabilities by exploitability and generate automated remediation suggestions, making your registry a smarter security checkpoint.

Registry as a Service Boundary

Your container registry defines the boundary between image build pipelines and runtime environments. Images flow in one direction: from CI/CD pipelines to the registry, then from the registry to CDE platforms. This separation enables independent scaling, security controls, and clear ownership between platform and development teams. In 2026, registries also serve as the trust boundary for SBOM (Software Bill of Materials) attestation, ensuring every image carries verifiable provenance metadata.

Registry Options for CDE Image Management

Choose the right registry for your organization's scale, security requirements, and cloud strategy.

RegistryBest ForSecurity ScanningKey FeaturesLimitations
Docker HubSmall teams, public imagesDocker ScoutLargest public registry, easy setup, unlimited pulls for paid plansRate limits on free/unauthenticated pulls, limited private repos on free tier
GitHub Container RegistryGitHub-native workflowsGitHub Advanced Security, DependabotFree public images, GitHub Actions integration, GITHUB_TOKEN auth, multi-arch supportGitHub-specific, private image storage tied to plan quotas
AWS ECRAWS-native workloadsAmazon Inspector (enhanced scanning)IAM integration, lifecycle policies, cross-region replication, container-to-image mappingAWS-only, no built-in UI
Azure ACRAzure-native workloadsMicrosoft Defender for ContainersEntra ID auth, geo-replication, task runners for image buildsAzure-only, premium tier required for replication
Google Artifact RegistryGCP-native workloadsContainer Analysis APIGCP IAM, multi-format support (Maven, npm, Python), vulnerability insightsGCP-only, legacy GCR shut down (migrated to Artifact Registry)
HarborSelf-hosted, multi-tenancyTrivy (built-in)Open source, RBAC, Cosign image signing, replication, AI model registry (CNAI), air-gapped supportSelf-managed, requires operational overhead
GitLab RegistryGitLab CI/CD usersGitLab Security ScanningIntegrated with GitLab CI, per-project registries, dependency scanningGitLab-specific, limited standalone features

Cloud-Native Registries

If your CDE platform runs on AWS, Azure, or GCP, use the native registry service. ECR, ACR, and Artifact Registry integrate seamlessly with IAM, offer the lowest latency for pulls, and simplify billing. These registries automatically scale, handle authentication through cloud identity, and work out-of-the-box with managed Kubernetes services.

Pro tip: Use lifecycle policies to automatically delete old images. Most teams keep the last 10-20 versions of each image and purge anything older than 90 days to control storage costs.

Self-Hosted Options

Harbor is the gold standard for self-hosted registries. It provides enterprise features like multi-tenancy, RBAC, vulnerability scanning, Cosign-based image signing, and replication across data centers. Harbor v2.13+ also supports AI model management through its CloudNativeAI (CNAI) integration, making it a unified registry for both container images and ML models. Perfect for air-gapped environments, hybrid cloud, or organizations requiring full control over image storage and access policies.

Pro tip: Run Harbor on Kubernetes with persistent storage backed by object storage (S3, Azure Blob, GCS) for durability and cost-efficiency.

Image Strategy for Development Environments

Build efficient, maintainable container images optimized for fast workspace startup and developer productivity.

Base Image Layering

Structure images in layers: OS base, language runtime, common tools, project-specific dependencies. This layering enables Docker to cache unchanged layers, dramatically speeding up builds and pulls. Change only what's necessary in each layer.

1. ubuntu:24.04 (OS)
2. + Node.js 22
3. + Common tools
4. + Project deps

Golden Images

Create "golden" base images for each tech stack (Node.js, Python, Java, Go). Include standard tooling, security hardening, and company policies. Teams extend these golden images for project-specific needs, ensuring consistency and security compliance across all workspaces.

  • Pre-approved tools and versions
  • Security patches applied
  • Compliance requirements met
  • SBOM attestation embedded

Multi-Stage Builds

Use multi-stage Dockerfiles to separate build-time and runtime dependencies. Build your application in one stage with full toolchains, then copy only the compiled artifacts to a minimal runtime stage. This reduces image size by 50-90% and eliminates build tools from production images.

FROM node:22 AS builder
FROM node:22-slim AS runtime
COPY --from=builder /app

Optimization Strategies

Layer Order Matters

Place instructions that change frequently (like COPY source code) at the bottom of your Dockerfile. Put instructions that rarely change (OS packages, language runtimes) at the top. Docker caches layers, so this ordering means most builds reuse cached layers and only rebuild what changed.

Minimize Layer Count

Chain related commands with && to create fewer layers. Each RUN, COPY, or ADD instruction creates a new layer. Combining commands reduces layer count and image size. Clean up temporary files in the same RUN command that creates them to keep them out of the final image.

Use .dockerignore

Create a .dockerignore file to exclude unnecessary files from the build context. Exclude node_modules, .git, test files, documentation, and IDE configs. This speeds up builds by sending less data to the Docker daemon and prevents accidental inclusion of secrets or large files.

Pin Versions

Always specify exact versions for base images and dependencies. Use node:22.14.0 instead of node:22 or node:latest. Pinning versions ensures reproducible builds and prevents unexpected breakages when upstream images update. Update versions deliberately through your CI/CD pipeline.

AI-Powered Image Management

AI is transforming how teams build, scan, and manage container images - from automated Dockerfile generation to intelligent vulnerability prioritization.

AI-Generated Dockerfiles

AI coding assistants can generate Dockerfiles with multi-stage builds, optimized layer ordering, and minimal image sizes. Tools like Docker's GenAI integration and IDE-based AI assistants propose production-ready Dockerfiles from project analysis. While AI provides a strong starting point, human review remains essential for security constraints and runtime requirements.

  • Auto-detects language and framework
  • Suggests multi-stage build patterns
  • Optimizes layer caching automatically

AI Vulnerability Prioritization

With 87% of container images containing high or critical vulnerabilities, AI-powered scanning tools cut through the noise. Platforms like Snyk, Aqua Security, and Aikido use AI agents to autonomously identify misconfigurations, prioritize vulnerabilities by real-world exploitability, and generate one-click remediation fixes - reducing triage time from hours to minutes.

  • Contextual risk scoring beyond CVSS
  • Automated fix pull requests
  • Exploitability-based prioritization

ML Model Images in Registries

Container registries are evolving to store more than just application images. Harbor's CloudNativeAI (CNAI) integration and OCI artifact support enable teams to store AI/ML model weights, datasets, and inference runtimes alongside application containers. This unifies the artifact pipeline for teams building AI-powered development tools and CDE-hosted AI agent workspaces.

  • OCI artifacts for model storage
  • GPU-optimized base images for AI workloads
  • Unified lifecycle management for code and models

AI Agents Need Container Images Too

As AI coding agents become standard development tools, each agent session runs inside a sandboxed container. This means your registry strategy must account for agent workspace images alongside developer workspace images. Agent images typically need specific tool versions, CLI access, and security constraints. Treat agent image templates as first-class artifacts in your registry with the same versioning, scanning, and lifecycle policies you apply to developer images.

Security Scanning and Vulnerability Management

Detect and remediate vulnerabilities before they reach development environments. Automate security scanning at every stage of the image lifecycle.

Trivy

Open Source Vulnerability Scanner

Trivy scans container images for vulnerabilities in OS packages and application dependencies. It's fast, accurate, and easy to integrate into CI/CD pipelines. Trivy supports multiple languages (Node.js, Python, Java, Go, Ruby, Rust) and detects CVEs from multiple databases including NVD, Red Hat, Debian, and Alpine advisories. Recent versions add concurrent database access for parallel scanning, expanded SBOM support (CycloneDX and SPDX), and detection for container-optimized operating systems like Bottlerocket.

trivy image myregistry.io/app:latest
  • Free and open source
  • Scans in seconds, no server required
  • SBOM generation and analysis (CycloneDX, SPDX)
  • Detects misconfigurations, secrets, and license issues

Snyk Container

Commercial Developer Security Platform

Snyk provides comprehensive vulnerability scanning with AI-powered prioritized remediation advice. It goes beyond CVE detection to offer fix recommendations, license compliance checking, and base image suggestions. Snyk integrates with registries, CI/CD, and IDEs, providing security feedback throughout the development lifecycle. Its AI-driven risk scoring considers real-world exploitability, not just CVSS severity.

snyk container test myregistry.io/app
  • AI-prioritized vulnerabilities by exploitability
  • Automated fix PRs
  • License compliance monitoring
  • Alternative base image recommendations

Vulnerability Policies and Enforcement

Define Severity Thresholds

Establish clear policies for vulnerability severity. Common approach: block critical and high severity CVEs, warn on medium, ignore low. Tune thresholds based on your risk tolerance and compliance requirements. Different policies for development vs production images are acceptable.

Critical: BLOCK
High: BLOCK
Medium: WARN
Low: ALLOW

Admission Controllers

Use Kubernetes admission controllers like Open Policy Agent (OPA) or Kyverno to enforce image policies at runtime. Block pods from starting if their images contain vulnerabilities above your threshold or lack required security scans. Kyverno, now a CNCF Incubating project, supports validation, mutation, generation, and cleanup policies using simple YAML - no Rego required. This prevents vulnerable images from ever reaching your CDE platform.

Admission webhooks intercept pod creation requests and validate image metadata, SBOM attestations, and vulnerability scan results before allowing deployment.

Continuous Scanning is Essential

Vulnerabilities are discovered continuously. An image that was clean last month might have critical CVEs today. Configure your registry to automatically rescan images on a schedule (daily or weekly). Alert teams when new vulnerabilities are discovered in images currently in use, and track remediation through fix deployment. AWS ECR enhanced scanning with Amazon Inspector now maps images to running containers, showing exactly which EKS pods and ECS tasks use each vulnerable image.

Image Lifecycle Management

Establish processes for tagging, promoting, retaining, and retiring container images throughout their lifecycle.

Tag Strategies

Use semantic versioning for release images and commit SHAs for development builds. Avoid mutable tags like "latest" in production. Instead, use immutable tags that always point to the same image content.

myapp:v1.2.3
Release version (immutable)
myapp:sha-a1b2c3d
Git commit SHA (immutable)
myapp:main
Branch pointer (mutable, dev only)

Promotion Workflows

Images flow through environments: dev, staging, production. Promote images by retagging (ECR, ACR) or replicating to environment-specific registries. This ensures the exact same image bits that passed testing reach production.

Dev
Staging
Prod

Same SHA, different environment tags

Retention Policies

Define how long to keep images. Common policy: keep the last 20 versions of each image, or all images from the last 90 days. Delete untagged images after 7 days (these are intermediate layers or failed builds).

  • Production images: Keep for 1 year
  • Development images: Keep last 20 versions
  • Untagged images: Delete after 7 days
  • Vulnerable images: Flag for immediate remediation

Garbage Collection

Container registries accumulate image layers over time. Most cloud registries handle garbage collection automatically. For Harbor or self-hosted registries, run garbage collection weekly to reclaim storage from deleted images.

Storage savings: Teams typically see 30-50% storage reduction after implementing retention policies and regular garbage collection.

Caution: Garbage collection in Harbor requires downtime. Schedule during maintenance windows.

Automate Lifecycle Management

Configure lifecycle policies in your registry to automate image retention and deletion. ECR lifecycle policies, ACR retention policies, and Harbor retention rules can automatically delete old images based on age, count, or tags. This prevents manual cleanup and controls storage costs without human intervention.

Private Registry Setup and Operations

Deploy and operate private registries for secure, performant, and globally distributed image storage.

Authentication and Access Control

Integrate registries with your identity provider (OIDC, Entra ID, Okta). Use service accounts for CI/CD pipelines and individual credentials for developers. Implement RBAC to control who can push, pull, and delete images. Separate read-only access for production systems from read-write access for build pipelines. Harbor v2.13+ supports OIDC with PKCE for enhanced authentication security.

Example RBAC Model:

  • Developers: Pull from all, push to dev registries
  • CI/CD: Push to all registries
  • Production: Pull only from prod registry
  • Admins: Full access including deletion

Replication and High Availability

Replicate images across regions for fault tolerance and low-latency pulls. Cloud registries offer geo-replication (ECR cross-region replication, ACR geo-replication, Artifact Registry multi-region). Harbor supports push-based and pull-based replication to sync images between registries.

Replication Strategies:

  • Active-Active: Push to multiple regions
  • Primary-Replica: Replicate from primary to secondaries
  • Cache: Pull-through cache for external registries

Geo-Distributed Registries

Deploy registries close to your CDE workload locations. If teams are distributed globally, replicate images to regional registries to reduce pull times from minutes to seconds. Use DNS-based routing or registry mirrors to automatically direct pulls to the nearest registry.

US East: registry-us-east.example.com
EU West: registry-eu-west.example.com
Asia Pacific: registry-ap-south.example.com

Caching Proxies and Pull-Through Cache

Configure your registry as a pull-through cache for Docker Hub and other public registries. When developers request public images, the registry pulls from upstream once and caches locally. Subsequent pulls are instant and do not count against Docker Hub rate limits.

Harbor proxy cache example: Configure Docker Hub as a proxy endpoint. Developers pull node:22 from your registry, which transparently caches from Docker Hub.

docker pull registry.example.com/dockerhub/node:22

Performance Optimization

Bandwidth

Use fast storage backends (NVMe SSDs) and high-bandwidth networking. Cloud registries automatically scale bandwidth. For self-hosted registries, provision sufficient network capacity for concurrent pulls during workspace startup surges.

Concurrent Pulls

Tune worker threads and connection limits for registries. Harbor defaults to 10 concurrent pulls per core. Increase for high-concurrency scenarios where 100+ developers might start workspaces simultaneously during standup or after an outage.

Storage Backends

Use object storage (S3, Azure Blob, GCS) for registry backends instead of local disk. Object storage is durable, scales infinitely, and supports geo-replication. It's also more cost-effective at scale than provisioning large disk volumes.

DevContainer Image Patterns

Choose the right image build strategy for your DevContainers to balance startup speed, flexibility, and maintenance burden.

Pre-Built Images

Fastest Startup

Build container images in CI/CD pipelines and push to your registry. DevContainer configuration references the pre-built image. Workspaces start in seconds because they just pull and run the image. No build time at workspace creation.

devcontainer.json:

{
  "image": "registry.example.com/myapp:latest"
}
Workspace starts in 5-15 seconds
Consistent environment for all developers
No build dependencies in CDE platform
Requires CI/CD pipeline for image updates

Build-on-Start

Most Flexible

DevContainer builds the image when the workspace starts, using a Dockerfile in the repository. Developers can modify the Dockerfile and immediately see changes. Good for experimentation and projects with frequently changing dependencies.

devcontainer.json:

{
  "dockerFile": "Dockerfile"
}
Easy to modify and experiment
No CI/CD required for image updates
Slow startup (2-10 minutes for first build)
Inconsistent if developers customize Dockerfiles

Prebuild Pipelines (Best of Both Worlds)

Use prebuild pipelines to automatically build images when the repository changes, then store them in your registry. CDE platforms like Ona (formerly Gitpod), GitHub Codespaces, and Coder support prebuilds. When a developer starts a workspace, they get the pre-built image from the last commit, giving near-instant startup with up-to-date dependencies.

How It Works

On every commit to main, a webhook triggers a prebuild. The CDE platform builds the container image and stores it. When developers start workspaces from main, they get the pre-built image instantly.

Branch Strategy

Prebuild main and long-lived branches. Feature branches build on-demand or extend the main prebuild. This balances resource usage with developer experience for the majority of workspaces.

Cost Optimization

Prebuilds consume compute resources. Configure prebuilds for high-traffic branches only. Skip prebuilds for commits to docs or CI configs. Use conditional webhooks or file path filters.

Image Size Optimization

Keep Images Lean

Smaller images pull faster. A 5GB image takes 10x longer to pull than a 500MB image. Use Alpine, distroless, or Chainguard base images when possible. Remove build tools and caches in the same layer where they are created. Multi-stage builds help eliminate build-time dependencies from final images.

  • Target: Keep dev images under 2GB
  • Monitor: Track image size in CI/CD
  • Alert: Fail builds if images grow beyond thresholds

Layer Caching

Docker caches layers during builds. Order Dockerfile instructions from least-frequently-changed to most-frequently-changed. Install OS packages first, language runtimes second, application dependencies third, and copy source code last. This maximizes cache hits and minimizes rebuild time.

RUN apt-get update && apt-get install...
RUN curl -o- nodejs.org/install.sh | bash
COPY package.json .
RUN npm install
COPY . .

Frequently Asked Questions

Common questions about container registries and image management for CDEs.

Should we use one registry for all environments or separate registries per environment?

Use separate registries (or at minimum, separate repositories within one registry) for development, staging, and production. This provides isolation, enables environment-specific access controls, and prevents accidental promotion of untested images to production. Cloud registries make multiple registries cheap and easy to manage with replication and lifecycle policies.

How do we handle base image updates when security vulnerabilities are discovered?

Automate base image updates through CI/CD. When your registry detects vulnerabilities in base images, trigger a rebuild of all dependent images with the patched base. Test rebuilt images in staging, then promote to production. Configure alerts for new CVEs and set SLAs for remediation (typically 7 days for critical, 30 days for high severity). Use tools like Renovate or Dependabot to automate base image version updates in Dockerfiles.

What's the best way to handle large binary dependencies in container images?

Store large binaries outside images when possible. Use init scripts to download binaries at workspace startup from S3 or artifact repositories. For binaries that must be in images, use multi-stage builds to fetch and install them in a single layer, and compress with tools like UPX. Consider using lazy-pulling technologies like Nydus or Stargz Snapshotter that stream image layers on-demand instead of pulling entire images.

How do we prevent developers from using unapproved or vulnerable base images?

Implement admission control policies using OPA or Kyverno in Kubernetes. Define allowed base image registries and repositories in policy. Block pods that use images from external registries or images without recent security scans. Provide a catalog of approved golden images and require all Dockerfiles to extend from this catalog. Use CI/CD checks to validate Dockerfiles before they reach production, failing builds that reference unapproved images.

How should we manage container images for AI agent workspaces?

Treat AI agent workspace images as first-class artifacts with dedicated golden images. Agent images need specific CLI tools, language runtimes, and security constraints that differ from developer images. Apply stricter network isolation policies and filesystem restrictions since agents operate autonomously. Version agent images independently from developer images, and include SBOM attestation so your security team can audit exactly what tools and dependencies each agent has access to.

What is SBOM attestation and why does it matter for container images?

A Software Bill of Materials (SBOM) is a machine-readable inventory of every package, library, and dependency inside a container image. SBOM attestation cryptographically signs this inventory and attaches it to the image using tools like Cosign and in-toto. This lets downstream consumers verify exactly what is inside an image before deploying it. Registries like Harbor now support SBOM storage natively, and tools like Trivy can both generate and scan SBOMs in CycloneDX and SPDX formats.