Skip to content

cli/command/service: preserve mount order on force update - #7227

Merged
thaJeztah merged 1 commit into
docker:masterfrom
kawmy:7226-preserve-mount-order
Sep 2, 2026
Merged

thaJeztah merged 1 commit into
docker:masterfrom
kawmy:7226-preserve-mount-order

Conversation

@kawmy

@kawmy kawmy commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

- What I did

Fixed docker service update --force so it preserves the existing service mount order when no mount options are supplied.

This prevents a subsequent identical docker stack deploy from detecting a mount-order difference and unnecessarily rolling the service again.

Fixes #7226

- How I did it

Changed updateService() to call updateMounts() only when --mount-add or --mount-rm was explicitly changed.

Added a regression test that performs a force-only update and verifies that:

  • ForceUpdate is incremented.
  • The existing mount order remains unchanged.

- How to verify it

Run:

go test -mod=vendor ./cli/command/service -run '^TestUpdateServiceForcePreservesMountOrder$' -count=1
go test -mod=vendor ./cli/command/service -run '^TestUpdate' -count=1

The regression test, all service update tests, and the complete service package passed locally in a disposable container environment.

- Human readable description for the release notes

Preserve service mount order during forced updates to avoid an unnecessary rollout on the next stack deploy.
OIP

Signed-off-by: Kamyar mofakhami <41609894+kawmy@users.noreply.github.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cli/command/service/update.go 0.00% 2 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@thaJeztah thaJeztah 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

@thaJeztah
thaJeztah merged commit be607d1 into docker:master Sep 2, 2026
107 of 109 checks passed
leonieziechmann added a commit to leonieziechmann/betula.app that referenced this pull request Sep 30, 2026
…itch

The priority label restarts nothing on the server: its docker (29.8.1 since 2026-09-20) sends
swarm the changed label and nothing else, checked 2026-09-30 on the four Folia services (the raw
PreviousSpec equals the Spec after the switches of canary and canary-green, every task older than
its switch still runs). A CLI before 29.8.0 sorts the mounts on every "service update"
(docker/cli#7227): Folia's tmpfs moves to the front, a new task template for swarm, and the web
server restarts - seen in a test swarm with 29.3.1.

The warning said "swarm is not meant to restart them", which was wrong exactly when it fired; it
now names the CLI version and what the restart means for the traffic. The comment also says how
to compare the specs: "docker service inspect" fills swarm's defaults into Spec only, so an empty
DNSConfig and the rollback's Monitor look new after every update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leonieziechmann added a commit to leonieziechmann/betula.app that referenced this pull request Sep 30, 2026
…n switch restarts nothing with the server's docker 29.8.1 (checked on the four Folia services: the raw PreviousSpec equals the Spec after a switch, every task older than its switch still runs); a docker CLI before 29.8.0 sorts the mounts on every `service update` (docker/cli#7227) and so restarts Folia, which 55-switch.sh now says in its comments and in the warning it prints when the tasks change; `docker service inspect` fills swarm's defaults into Spec only, so its PreviousSpec/Spec diff always shows an empty DNSConfig

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leonieziechmann added a commit to leonieziechmann/betula.app that referenced this pull request Sep 30, 2026
… switch

The priority label restarts nothing with the server's docker (29.8.1, checked 2026-09-30 on the
four Folia services). The restart seen in a test swarm with 29.3.1 came from its CLI, which sorts
the mounts on every "service update" before 29.8.0 (docker/cli#7227); the "empty DNSConfig" was
docker service inspect filling swarm's defaults into Spec only, not a change. The wait after the
switch stays: seconds when nothing restarts. master says the same in 55-switch.sh (c8949a6).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docker service update --force silently reorders service mounts; subsequent identical docker stack deploy rolls the service again

3 participants