Skip to content

Dry-Run & Migration Mode

DockerWorks includes a Dry-Run mode (--dry-run on sync and daemon, or dry_run: true in config.yaml) so you can safely validate your configuration and migrate existing manually deployed containers to GitOps without touching running containers.

What Dry-Run Does

When Dry-Run is active for an app:

  1. Runs read-only remote checks: Executes git ls-remote and registry HEAD/GET digest checks as normal.
  2. Stages into an isolated temporary directory: Clones/pulls Git or OCI artifacts into a temporary folder (leaving your live work_dir, /etc/containers/systemd, and state.json untouched).
  3. Validates SOPS & Go Templates: Runs sops --decrypt and Go text/template rendering inside the staging directory so you catch missing keys, permissions, or template errors early.
  4. Logs exact planned commands: Prints the exact docker compose / podman compose or systemctl / podman commands that would run—without pulling images, restarting containers, running hooks, or pruning.

Migrating Existing Containers Step-by-Step

1. Test One-Shot with docker-works sync --dry-run

# Dry-run all apps
docker-works sync --config /etc/docker-works/config.yaml --dry-run

# Dry-run a single app
docker-works sync --config /etc/docker-works/config.yaml --app my-app --dry-run

2. Run in Shadow / Observe Mode (daemon --dry-run)

Run the daemon alongside your existing manual containers to verify polling intervals, webhooks, and SOPS/template rendering over time:

docker-works daemon --config /etc/docker-works/config.yaml --dry-run

3. Gradual Cutover with Per-App dry_run

Set defaults.dry_run: true globally and flip individual apps to dry_run: false as you migrate them one by one:

defaults:
  runtime: "podman"
  dry_run: true # Safe observe mode by default

apps:
  - name: "migrated-nginx"
    dry_run: false # Live GitOps enabled for this app
    git:
      repo: "https://github.com/myorg/nginx.git"

  - name: "legacy-postgres"
    # Inherits dry_run: true until ready to cut over
    git:
      repo: "https://github.com/myorg/postgres.git"

Prometheus Metric

When server.metrics_enabled: true is set, dry-run executions are recorded under docker_works_deployments_total{app="...",trigger="...",status="dry_run"} (or status="dry_run_failure").