Guardener Container Image Migration
Configure Guardener to open a pull request that replaces the container images a repository already uses with Chainguard …
For the complete documentation index, see llms.txt.
The Dockerfile migration feature converts your Dockerfiles to use Chainguard Containers. It uses AI to iteratively translate instructions, build images, compare results, and fix issues until the migrated Dockerfile works as expected.
Unlike Guardener’s Hardened Actions and Commit Verification features, Dockerfile migration does not run through the Chainguard App or the .chainguard/ configuration directory. Instead, you drive it locally through chainctl agent dockerfile commands. The AI runs server-side and scans your workspace to perform its analysis, while Docker builds and file access remain local to your machine.
Note: Guardener is in beta.
While Dockerfile migration is in beta, your organization needs to join the waitlist. Chainguard will notify you once registration becomes available. You can sign up on the Guardener landing page.
You also need the following:
chainctl installed on your local machine. Refer to our installation guide to set this up if you haven’t already done so.If you encounter permission errors, check your available organizations and verify role bindings:
chainctl iam organizations list -o table
chainctl iam role-bindings create --identity <identity> --role <role-with-repo.create>If you have access to more than one organization or folder, add --parent <organization> to the second command to choose where the role binding is created.
The migration agent runs on Chainguard’s servers, but it never touches your machine directly. Every file read, Docker build, and command is requested by the agent and mediated by chainctl on your machine. The local client evaluates each request, and only performs and returns the ones it deems acceptable — so you stay in control of what the agent can do and what data is sent back.
Your machine (client) Chainguard (server)
┌───────────────────────────┐ ┌──────────────────────┐
│ chainctl │◀── request ───│ Migration agent │
│ │ read a file, │ (AI) │
│ Dockerfile │ run a build, │ │
│ build context │ run a command│ │
│ Docker │ │ │
│ ▼ │ │ │
│ evaluate request: │ │ │
│ allowed? │ │ │
│ ▼ │─── result ───▶│ analyzes result, │
│ perform locally, │ (only for │ plans next step │
│ return result │ approved │ │
│ │ requests) │ │
└───────────────────────────┘ └──────────────────────┘Because every action is mediated by the local client, the agent can’t read a file, run a build, or execute a command unless chainctl approves the request first.
During a migration, the agent performs the following steps:
syft, an open source SBOM generator.If the agent cannot resolve an issue automatically, it prompts you for guidance with suggested alternatives.
The entire loop takes from five to more than thirty minutes, depending on the complexity of the Dockerfile.
Access to Dockerfile migration is governed by Chainguard IAM roles:
| Action | Minimum role |
|---|---|
| Accepting the Guardener legal terms for your organization (required once before anyone can run sessions) | guardener.admin or owner |
| Running Dockerfile migration sessions | guardener.user |
Refer to the Built-in roles and capabilities reference for details.
chainctl agent dockerfile includes the following subcommands:
| Command | What it does |
|---|---|
build | Migrate a Dockerfile to a Chainguard equivalent image |
optimize | Optimize an already-migrated Dockerfile |
upgrade | Upgrade package versions in a Dockerfile |
validate | Validate a migrated Dockerfile |
To run a basic migration, provide the path to your Dockerfile and a target image tag:
chainctl agent dockerfile build -f Dockerfile \
-t myapp:chainguardIf your image requires build arguments, pass them with --build-arg:
chainctl agent dockerfile build -f Dockerfile \
-t myapp:chainguard \
--build-arg VERSION=1.0For CI environments or automated workflows, use the --non-interactive flag to skip prompts and automatically select the first suggestion:
chainctl agent dockerfile build -f Dockerfile \
--non-interactiveTo resume a migration from a previously saved local state, use --resume:
chainctl agent dockerfile build -f Dockerfile \
--resumeTo optimize an already-migrated Dockerfile:
chainctl agent dockerfile optimize -f DockerfileTo run only specific optimizers, pass a comma-separated list with --optimizers:
chainctl agent dockerfile optimize -f Dockerfile \
--optimizers=cache,securityTo upgrade outdated packages in a Dockerfile:
chainctl agent dockerfile upgrade -f DockerfileTo preview what an upgrade would change without modifying any files, use the --dry-run flag:
chainctl agent dockerfile upgrade -f Dockerfile \
--dry-runTo validate a migrated Dockerfile:
chainctl agent dockerfile validate -f DockerfileWhen running the optimize subcommand, you can specify one or more of the following optimizers:
cache — Reorders instructions for better layer caching. The order of instructions determines where the build cache is invalidated. Reordering to take better advantage of layer caching leads to faster builds and reduced CI consumption.cleanup — Removes duplicate and redundant instructions. For example, copying one file vs COPY ..layers — Combines RUN commands and merges package installs. Reducing the number of layers results in a smaller image, faster pull times, and lower CI minute consumption.security — Adds --no-cache to apk, flags secrets, and suggests a non-root USER. Skipping the apk cache layer reduces image size, and using a non-root user limits root access to the host and removes the ability to install new packages at runtime.multi-stage — Transforms the Dockerfile into a multi-stage build using Chainguard runtime images. Chainguard containers come in a -dev variant with a package manager and shell, and a distroless runtime variant. Splitting into multiple stages produces a smaller runtime image with a reduced attack surface.native-packages — Replaces curl/bash installs with native apk packages, ensuring full provenance of packages rather than just the resulting binary.The migration agent runs server-side, but its access to your environment is scoped to what it needs to analyze and migrate a single Dockerfile:
APKINDEX.requirements.txt, package.json, and similar.--non-interactive mode it skips these prompts and automatically selects the first suggestion.Dockerfile migration has been tested with Python, Go, Node.js, Java, Spring Boot (UBI-based), and multi-stage Argo CD builds. The following example shows a simple Ubuntu-based Dockerfile converted to use cgr.dev/chainguard/wolfi-base:latest.
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y curl git python3
WORKDIR /app
COPY . .
CMD ["python3", "app.py"]FROM cgr.dev/chainguard/wolfi-base:latest
RUN apk add --no-cache curl git python3
WORKDIR /app
COPY . .
CMD ["python3", "app.py"]You need Docker installed and running locally, chainctl installed and authenticated, and a Chainguard organization that has joined the beta program.
Yes. Use --non-interactive to skip all prompts, and ensure your CI environment has Docker and a chainctl authentication token.
The chainctl agent dockerfile commands can take anywhere from five to more than thirty minutes depending on the size and complexity of the Dockerfile. For example, the optimize subcommand takes longer than build because it performs a more in-depth analysis.
Dockerfile migration is AI-based, which means its behavior is inherently non-deterministic. You may see slightly different results across runs, even with the same inputs. This is expected.
The agent makes probabilistic decisions based on patterns in the data rather than following a fixed set of rules. As a result, it can take different but equally valid paths when analyzing a Dockerfile, choosing optimizations, or resolving build issues. The overall outcome should be consistent across runs, but the exact steps, suggestions, or ordering may vary.
A network interruption causes the bidirectional gRPC stream to terminate, ending the session immediately.
The --resume flag only resumes from locally saved migration state, not from the live session. The server-side agent, its conversation history, and any in-flight work are lost when the connection drops. There is currently no server-side session recovery.
Docker is required, since all builds happen on your local machine. A fully managed headless mode with server-side builds is planned for a future release.
Last updated: 2026-09-28 14:00