Skip to content

feat(run): --no-recreate reuses existing dependencies as-is - #14144

Open
ndeloof wants to merge 1 commit into
docker:mainfrom
ndeloof:run-no-recreate
Open

feat(run): --no-recreate reuses existing dependencies as-is#14144
ndeloof wants to merge 1 commit into
docker:mainfrom
ndeloof:run-no-recreate

Conversation

@ndeloof

@ndeloof ndeloof commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

run starts its dependencies through the regular create path and its config-hash divergence check, with no way to opt out: any resolution difference with the command that created them recreates the dependency — destroying state a previous run built up (#13769: database losing its users). up already offers --no-recreate for exactly this; run now aligns.

The flag maps to the existing "never" recreate policy, propagated through the RunOptions.CreateOptions fields startDependencies previously dropped. Default behavior is unchanged (empty policy = "diverged"). E2E test pins both sides: default recreates a diverged dependency, --no-recreate reuses it as-is.

Closes #13769

🤖 Generated with Claude Code

The dependencies a one-off starts go through the regular create path
and its config-hash divergence check, with no way to opt out: any
resolution difference with the command that created them (environment,
model edit) recreates the dependency — destroying state a previous run
built up (issue docker#13769's database losing its users). up already offers
--no-recreate for exactly this; run now aligns: the flag maps to the
"never" recreate policy, propagated through the RunOptions.CreateOptions
fields that startDependencies previously dropped. Default behavior is
unchanged (empty policy = "diverged").

Closes docker#13769

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
@ndeloof
ndeloof requested review from a team as code owners August 27, 2026 16:01
@ndeloof
ndeloof requested a review from glours August 27, 2026 16:01

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

The flag implementation is clean and correct. The flag wires properly from the CLI option through createOptions.noRecreaterecreateStrategy() / dependenciesRecreateStrategy() (both already handle noRecreateRecreateNever), and the propagation into startDependencies via options.Recreate / options.RecreateDependencies is complete. Default behavior is unchanged. No logic errors, nil-pointer risks, or missing error handling found in the changed code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

container re-created when it shouldn't, if using docker-compose run

2 participants