Skip to content

fix(reconcile): preserve zero-replica services during hashing - #13931

Merged
glours merged 1 commit into
docker:mainfrom
junhaoliao:feat/preserve-zero-replica-services
Jul 16, 2026
Merged

fix(reconcile): preserve zero-replica services during hashing#13931
glours merged 1 commit into
docker:mainfrom
junhaoliao:feat/preserve-zero-replica-services

Conversation

@junhaoliao

@junhaoliao junhaoliao commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What I did

Prevent ServiceHash from mutating the caller's DeployConfig when excluding deploy.replicas from the service hash. This preserves deploy.replicas: 0 through reconciliation so docker compose up continues to skip zero-replica dependencies instead of waiting for a missing container.

Added a focused regression test that hashes a zero-replica dependency before running dependency-wait logic and verifies the dependency is still skipped.

Related issue

Fixes #13899.

Validation

gofmt -w pkg/compose/hash.go pkg/compose/convergence_test.go

No stdout/stderr.

go test ./pkg/compose -run 'TestServiceHash|TestWaitDependencies' -count=1

ok  	github.com/docker/compose/v5/pkg/compose	0.008s

go test ./pkg/compose -count=1

ok  	github.com/docker/compose/v5/pkg/compose	0.146s

go vet ./pkg/compose

No stdout/stderr.

go build -tags e2e -o /tmp/docker-compose-pr-build ./cmd

No stdout/stderr.

git diff --check

No stdout/stderr.

Signed-off-by: Junhao Liao <junhao@junhao.ca>
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@glours glours left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the contribution @junhaoliao 🙏

@glours
glours merged commit 536d8f3 into docker:main Jul 16, 2026
43 of 45 checks passed
@junhaoliao
junhaoliao deleted the feat/preserve-zero-replica-services branch July 16, 2026 15:50
@junhaoliao

Copy link
Copy Markdown
Contributor Author

@glours thanks for taking the patch.

May I ask if you're planning to make a release of the docker compose plugin any time soon? Having a new version will greatly help us to unblock releases of some our products. Thanks in advance!

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.

[BUG] Services with zero replicas fail to start when they have a dependency that has zero replicas

2 participants