sincecutoff.com
← all changes

docker-compose SDK ScaleOptions carries replica counts

Introduced 2026-09-03 · score 0.97

HOW TO USE IT

When scaling services through the Compose SDK, set `ScaleOptions.Replicas` to the desired service counts and call `Scale(ctx, project, options)`; `Services` selects services for recreation-policy handling and defaults to the replica-map keys when empty.

options := api.ScaleOptions{Replicas: map[string]int{"<service>": <replica-count>}} err := backend.Scale(ctx, project, options)

WHY THIS HELPS

Use the Compose SDK to scale services in a project.

BEFORE THIS CHANGE

The CLI mutated the project model with SetScale before calling the backend; SDK callers following the Scale interface documentation could get a no-op convergence because ScaleOptions had no replica count.

REQUIREMENTS AND LIMITATIONS

  • Version: v5.5.1
  • ScaleOptions.Replicas: Map service names to desired replica counts; Scale applies these counts to the project model before convergence.
  • ScaleOptions.Services: Services whose containers may be recreated on configuration divergence while converging; empty defaults to the keys of Replicas. No mutual exclusion with Replicas is documented.
  • Scale(ctx, project, options) (required): Scale sets replica counts and converges the project, creating, removing, and starting containers as needed.
  • A pre-mutated project with an empty `Replicas` map continues to work as before.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card