Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

docker ps -f should return nonzero exit status for no matches

オープン
#6,640 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
go
領域
cli

調査の方向性

docker ps コマンドとそのフィルター処理から始め、空の結果が現在どのようにプロセスの終了ステータスを決定しているかを追跡します。docker ps -f が一致するコンテナがない場合にゼロ以外のステータスを返し、期待される出力と統合動作を維持すれば、変更は完了です。

索引モデルが issue の本文から書いたものです。

説明

kind/feature status/0-triage
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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

docker/cli のほかの issue

docker/cli の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。