Skip to content

compose build --dry-run performs a real build and leaves a tagged image #74

Description

@KennethWKZ

mocker version: 0.7.2 (Homebrew) — macOS, Darwin 25.5.0, arm64

Summary

mocker compose build --dry-run executes a real build. BuildKit runs, layers are exported, and a tagged image is left in the image store. --dry-run is documented as "Execute command in dry run mode" and must not mutate state.

Reproduction

Any service with a build: section:

$ mocker compose -f flat.yml -p demo --project-directory /abs/path build --dry-run caddy
#7 exporting layers 0.0s done
#7 exporting manifest sha256:4431f16a57ab8ed33dd57a675bcd9f44c81c527bf4a776475e0e2f9d6b071d36 done
#7 exporting config sha256:3d11c086bab444a9b01c9cd333cae8f97a6b28bebd0ead0771eed684670dfc88 done
#7 exporting manifest list sha256:e2fa1a8d5a731b594df9fa23e705a47eced3419232494bccf049d94aacad67d3 done
#7 sending tarball
#7 DONE 0.4s
caddy:latest
Building caddy...
Successfully built caddy

The image exists afterwards:

$ mocker images | grep -i caddy
caddy   latest   sha256:e2fa1   in 0 sec   Zero KB

Expected

--dry-run prints the actions that would be taken and exits without invoking BuildKit or writing any image. Upstream docker compose build --dry-run reports the planned build steps only.

Worth auditing the flag across the other subcommands that advertise it (up, down, create, pull, run, stop, rm) — if it is a no-op parse for build, the others may accept and ignore it too. A silently-ignored --dry-run is worse than an unsupported-flag error, since --dry-run is the flag people reach for specifically to avoid touching anything.

Found while testing a build; the tagging behavior in that same output is filed separately as #73.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions