[BUG] Negative replica count in scale flags (docker compose scale / --scale) is accepted without validation
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 30/100
調査の方向性
The report identifies the scale and up --scale CLI paths but names no source files or tests. Start by tracing how each command parses and validates replica counts, then find the corresponding tests. Done means both commands reject negative counts while accepting zero and positive counts; an open linked pull request is already addressing this issue.
索引モデルが issue の本文から書いたものです。
説明
Description
According to the Compose Specification, scale must be a non-negative integer (>= 0). The Compose file loader already enforces this and rejects negative scale: values in compose.yaml.
Additionally, the CLI properly validates non-numeric inputs — for instance, docker compose scale web=abc immediately returns:
invalid scale specifier: can't parse replica value as int: web=abc
However, when passing a negative replica count through the CLI flags, such as docker compose scale web=-1 or docker compose up --scale web=-1, the value is accepted without any validation error. The service is then assigned a negative replica count, which leads to unexpected behavior during convergence and container lifecycle handling.
The CLI should validate that the replica count is non-negative, consistent with the Compose Specification and with how the compose file loader treats negative scales.
Steps To Reproduce
- Create a minimal
compose.yaml:services: web: image: alpine - Attempt to scale the service with a negative replica count:
Or:docker compose scale web=-1docker compose up --dry-run --scale web=-1
Observed Result
-
docker compose scale web=-1:[+] scale 1/1 ✔ Network a_default Created 0.0s service "web" has no container to startThe negative value
-1is accepted without any validation error. -
docker compose up --dry-run --scale web=-1:end of 'compose up' output, interactive run is not supported in dry-run modeThe command finishes without warning or error regarding the negative replica count.
Compose Version
$ docker compose version
Docker Compose version v5.5.0
Docker Environment
Docker version 29.9.3, build 5457199aa5
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.17.2
Path: /path/to/.docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v5.5.0
Path: /path/to/.docker/cli-plugins/docker-compose
Anything else?
No response
- 主要言語
- Go
- スター
- 38.9k
- フォーク
- 6k
- 平均マージ
- 2日 22時間
- マージ済み PR(30日)
- 81
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
docker/compose のほかの issue
-
[BUG] `docker compose port` prints `:0` (exit 0) for a port the image exposes but the service does not publish対応中かも @ndeloof が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
docker/compose#14435 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] deploy.restart_policy without condition drops the restart policy再び着手できるかも @akshat-lakhera が 25 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
docker/compose#14383 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] up: an optional (required: false) service_healthy dependent is not started when a required dependent shares the failing wait対応中かも @ndeloof が 2 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
docker/compose#14507 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] pre_stop hooks are skipped when up or scale stops a container対応中かも @htoyoda18 が 11 日前に担当しました。 オープンkind/bug status/approved
難易度 4/5 3〜5日 初心者へのやさしさ 53/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
fluxcd/notification-controller#1441 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
OneBusAway/maglev#2145 ·
メンテナーはふだん 2 日以内に返信
-
priority/medium status/ready type/chore
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
discobox-ai/discobox#1357 ·
メンテナーはふだん 1 日以内に返信
-
TestPseudoLocaleRemote fails now and then: it types the code before the laptop asks for it対応中かも @fzn0x が今日担当しました。 オープンbug priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
edit_file diff rendering panics on invalid UTF-8 text対応中かも @TDnorthgarden が今日担当しました。 オープンarea/tui
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
docker/docker-agent#4955 ·
メンテナーはふだん 1 日以内に返信