docker ps -f should return nonzero exit status for no matches
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia dal comando docker ps e dalla gestione dei relativi filtri, quindi segui il modo in cui un risultato vuoto determina attualmente lo stato di uscita del processo. La modifica è completata quando docker ps -f restituisce uno stato diverso da zero in assenza di container corrispondenti, mantenendo l'output previsto e il comportamento di integrazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Go
- Stelle
- 6.1k
- Fork
- 2.2k
- Merge medio
- 1g 10h
- PR unite (30g)
- 47
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di docker/cli
-
kind/bug status/0-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
kind/bug status/0-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
kind/feature status/0-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
kind/bug status/0-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
bug group: validation priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
codecheckers/chekhov#51 ·
-
Creating worktree from an existing remote branch with a slash in it, has unexpected behaviour Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100