Skip to content

Fix unwanted container recreation caused by label drift in staker daemon#2413

Open
Marketen wants to merge 1 commit intodevelopfrom
marc/container-recreation
Open

Fix unwanted container recreation caused by label drift in staker daemon#2413
Marketen wants to merge 1 commit intodevelopfrom
marc/container-recreation

Conversation

@Marketen
Copy link
Copy Markdown
Contributor

@Marketen Marketen commented Mar 10, 2026

Consensus packages were being unexpectedly restarted after installation. The ensureDockerNetworkConfigs daemon, which runs every 2 minutes, triggered docker compose up on staker packages. On its first run after install, Docker Compose detected config changes and recreated the containers.

Root cause:
In applyUserSettings(), the dappnode.dnp.default.* labels were overwritten on every call:

writeDefaultsToLabels() computes labels from the current service state in the compose file — which by the time the daemon runs already contains user-applied values (e.g. CHECKPOINT_SYNC_URL=https://...) and port normalization (9712:9712 instead of 9712:9712/tcp). These differ from the original labels written at install time, so the compose file changes, and Docker Compose sees a new service definition and recreates the container.

Fix:
Reverse the spread order so existing labels are preserved:

This makes the daemon idempotent — on re-runs, the original package defaults stored in labels are preserved, the compose file stays unchanged, and docker compose up is a no-op.

@Marketen Marketen requested a review from a team as a code owner March 10, 2026 15:27
@github-actions github-actions bot temporarily deployed to commit March 10, 2026 15:29 Inactive
@github-actions
Copy link
Copy Markdown

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.

1 participant