Fix container recreation by computing default labels from post-applied values#2414
Open
Fix container recreation by computing default labels from post-applied values#2414
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
Staker packages (consensus, execution, etc.) were unexpectedly restarted after installation. The
ensureDockerNetworkConfigsdaemon runs every 30 minutes and calls docker compose up on staker packages. On the first run after install, Docker Compose detected label changes and recreated the containers.Root cause:
applyUserSettings()computeddappnode.dnp.default.*labels from the pre-applied service values (raw manifest env vars, un-normalized ports). But the compose file was written with post-applied values (populated env vars, TCP-normalized ports). When the daemon re-ran and recomputed labels from the now-modified compose, the label values changed — triggering Docker Compose to see a config diff and recreate containers.Fix:
Compute default labels from the already-resolved output values
(nextEnvironment, nextPorts, nextServiceVolumes)instead of the raw input. This makes labels match the compose content from the start, so the daemon recomputing them produces the same result — no diff, no restart.