docker ps -f should return nonzero exit status for no matches
まだ誰も着手していません。
評価
調査の方向性
docker ps コマンドとそのフィルター処理から始め、空の結果が現在どのようにプロセスの終了ステータスを決定しているかを追跡します。docker ps -f が一致するコンテナがない場合にゼロ以外のステータスを返し、期待される出力と統合動作を維持すれば、変更は完了です。
索引モデルが issue の本文から書いたものです。
説明
Description
As per vdemeester comment, re-opening https://github.com/moby/moby/issues/35057.
Reason to close was command will return zero even when "docker ps" returns no containers.
If instead docker ps returns ie 1 or not zero when container is not running, it then enables better integration with other tooling:
# Conventional Exit Code Use - ls command on folder exists, not-exists
if [[ $( ls /tmp 2>/dev/null ) ]]; then echo "folder exists"; else echo "folder does not exist"; fi
folder exists
if [[ $( ls /tmpXX 2>/dev/null ) ]]; then echo "folder exists"; else echo "folder does not exist"; fi
folder does not exist
# Docker ps - Less Useful Zero Exit Code
if [[ $( docker ps --filter label=runningimage=no 2>/dev/null ) ]]; then echo "container is running"; else echo "container is not running"; fi
container is running
??? WHY
eg, docker ps - no containers are running
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
....
Another closer example, "pgrep" - listing processes by process matching, clearly explains rationale:
...
-c, --count
Suppress normal output; instead print a count of matching processes. When count does not match anything, e.g. returns zero, the command will return
non-zero value. Note that for pkill and pidwait, the count is the number of matching processes, not the processes that were successfully signaled or
waited for.
- 主要言語
- Go
- スター
- 6.1k
- フォーク
- 2.2k
- 平均マージ
- 1日 10時間
- マージ済み PR(30日)
- 47
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
docker/cli のほかの issue
-
kind/bug status/0-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
kind/bug status/0-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
kind/feature status/0-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
kind/bug status/0-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
Bob Shell support オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
santhosh-tekuri/jsonschema#276 ·