Skip to content

fix(docker): resolve the recreate's source image by image ID - #1352

Merged
scttbnsn merged 4 commits into
dev/v1.7from
fix/v1.7-runtime-defaults-source-by-id
Oct 9, 2026
Merged

scttbnsn merged 4 commits into
dev/v1.7from
fix/v1.7-runtime-defaults-source-by-id

Conversation

@scttbnsn

@scttbnsn scttbnsn commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1351.

After an update the recreated container kept the old image's env, labels, entrypoint and command. Drydock decides which values are image defaults by comparing the container with the image it was created from, and it looked that image up by tag. On a same-tag update the pull has already moved the tag, so it compared the container with the new image, every old default looked like something the operator set, and it got carried over.

What changed:

  • The source image is looked up by the container's image ID. The tag is only used when the container spec has no image ID, and never as a retry after an ID lookup fails.
  • The hook label provenance check from fix(hooks): drop image-inherited hook labels when recreating a container #1347 reuses that one lookup instead of inspecting the image a second time. Hook labels are still only ever checked against the image read by ID.
  • An entrypoint or command that matches the source image is stamped inherited. It used to be stamped explicit on a container's first update whenever the new image kept the same value, which pinned it. On rc.21 a later image that replaced the entrypoint script then failed to start and rolled back.

What doesn't change: values set on the container are carried over as before. If the old image has already been deleted from the host, the source is unknown and everything is kept. Containers an earlier version already updated still hold stale values and need one recreate, since a stale default can't be told apart from a value the operator set. The docs have a new "Image defaults after an update" section covering this.

Tested on real containers with a local build, Docker and Compose actions: same-tag update, tag climb, operator env kept, old tag removed, old image deleted, entrypoint script replaced, and two same-tag rounds in a row. The hook label matrix from #1347 was rerun and still passes.

Changelog

  • 🐛 Fixed stale runtime defaults during container recreation. Drydock now inspects the source image by container image ID. It uses the tag only when the container has no image ID, and does not fall back to the tag if ID inspection fails.
  • 🔧 Changed runtime-field provenance. Drydock can mark unlabelled entrypoint and command values as inherited when they match the source image. Explicit labels remain explicit.
  • 🔧 Changed hook-label provenance to use the inspected source image configuration.
  • ✨ Added Docker and Compose regression tests for same-tag updates, image defaults, operator overrides, and unavailable source images.
  • ✨ Documented image-default behavior and how to recreate containers that may retain stale values.
  • ⚠️ When Drydock cannot inspect the source image, it cannot identify inherited values and preserves them. Containers updated by an earlier version may need another recreate to clear stale values.

Concerns

  • Test execution results are not included in the supplied inspection output.

A recreate compares the old container with the image it was created from
to tell an inherited Entrypoint, Cmd, Env or label from one the operator
set. It looked that image up by Config.Image. After a same-tag pull the
tag already points at the new image, so every inherited value looked
operator-set and was carried onto the new container. A tag@digest that an
earlier update pinned, or an old tag that is no longer on the host, stops
resolving altogether, which kept everything as well.

The image is now read by the container's image ID. Config.Image only
stands in for a spec that has no image ID. It isn't tried again when the
ID can't be inspected, because by then it may name a different image.

Fixes: #1351
The runtime defaults and the hook label provenance both read the image
the old container was created from by image ID, so one inspect now
serves both. getHookLabelProvenance takes that image's config instead of
inspecting it again.

Hook labels are still only ever checked against an image read by ID.
When the spec has no image ID, Config.Image stands in for the runtime
defaults and the hook provenance stays unknown, as before.
A recreate stamps dd.runtime.entrypoint.origin and dd.runtime.cmd.origin
on the new container. A container drydock had never updated carries
neither label, and an Entrypoint or Cmd it inherited from its image was
stamped explicit whenever the new image kept the same value. Every later
update then read it as set by the operator and carried it over, even
after an image changed it.

A field with no origin label that matches the image the container was
created from is now stamped inherited when it is kept, which is how the
drop decision already reads it. A field already stamped explicit stays
explicit, and so does one the source image can't vouch for.

Refs: #1351
Add a section to the Docker action page on which values a recreated
container takes from the new image and which it keeps, and what to do
with a container an earlier version left holding stale defaults: one
forced recreate, because a stale default can't be told from a value the
operator set. The Compose page and the label reference point at it, and
the changelog entry links it.

Refs: #1351
@vercel

vercel Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
drydock-website Ready Ready Preview Oct 9, 2026 4:49pm UTC
drydockdemo-website Building Building Preview Oct 9, 2026 4:49pm UTC

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: CodesWhat/drydock/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4edd20fe-fe28-4acb-afe9-61a0a070be01

📥 Commits

Reviewing files that changed from the base of the PR and between 37b5b5e and 96b4d3f.


⛔ Files ignored due to path filters (1)
  • CHANGELOG.md is excluded by !CHANGELOG.md

📒 Files selected for processing (8)
  • app/triggers/providers/docker/ContainerRuntimeConfigManager.test.ts
  • app/triggers/providers/docker/ContainerRuntimeConfigManager.ts
  • app/triggers/providers/docker/Docker.test.ts
  • app/triggers/providers/docker/Docker.ts
  • app/triggers/providers/dockercompose/Dockercompose.compose-exec-and-hooks.test.ts
  • content/docs/current/configuration/triggers/docker-compose/index.mdx
  • content/docs/current/configuration/triggers/docker/index.mdx
  • content/docs/current/configuration/watchers/index.mdx

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.



📝 Walkthrough

Walkthrough

Source image inspection now prefers the container’s image ID, with Config.Image as a fallback when no ID is available. Runtime-field origin annotation can classify matching unknown-origin values as inherited and compare them with the target image. Hook-label provenance uses the inspected source config. Docker and Compose tests cover same-tag image updates, refreshed inherited defaults, and preserved overrides. Documentation describes the reconciliation behavior and exceptions.

Fixed issue severity: <fixed_issue_severity>Medium</fixed_issue_severity>


Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 96b4d

No outstanding issue identified here prevents merging after normal checks.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check Passed Issue [#1351] requires refreshed runtime defaults after a container update, including image-provided environment variables such as APP_VERSION. The changes resolve the source image by container imag…
Out of Scope Changes check Passed The changes stay within [#1351]. The hook-label lookup reuse prevents related provenance regressions, the tests verify the runtime-default behavior, and the documentation explains the update behavior.…


✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@biggest-littlest biggest-littlest left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@ALARGECOMPANY ALARGECOMPANY left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@codecov

codecov Bot commented Oct 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

This branch was successfully deployed

2 active deployments
Preview – drydock-website — 96b4d3f8 Deployed Oct 9, 2026 by vercel[bot]
Preview – drydockdemo-website — 96b4d3f8 Deployed Oct 9, 2026 by vercel[bot]
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.

3 participants