Repository navigation
fix(docker): resolve the recreate's source image by image ID - #1352
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughSource image inspection now prefers the container’s image ID, with Fixed issue severity: <fixed_issue_severity>Medium</fixed_issue_severity> Priority: ➖ Normal Change: Bug fix Merge Risk: ⚪ Minimal · up to No outstanding issue identified here prevents merging after normal checks. 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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:
inherited. It used to be stampedexpliciton 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
Concerns