utility

Docker CLI

External Docker CLI communicates with a selected daemon; socket access can confer substantial privileges. Example executes only ./mock/docker and compares arguments; no daemon or version verified.

Formal Syntax & Structure

bash syntaxbash
docker ps [OPTIONS]

Return Value

exit status

External Docker CLI communicates with a selected daemon; socket access can confer substantial privileges. Example executes only ./mock/docker and compares arguments; no daemon or version verified.

Working Example

Example Snippetbash
mkdir mockcat > mock/docker <<'MOCK'#!/bin/bashprintf '%s\0' "$@" > argv.binprintf 'mock inventory\n'MOCKchmod 700 mock/dockerargs=(ps --filter 'label=team=daily report' --format '{{.Names}}')./mock/docker "${args[@]}" || exit 1mapfile -d '' -t observed < argv.bin[[ ${#observed[@]} == 5 && ${observed[2]} == 'label=team=daily report' && ${observed[4]} == '{{.Names}}' ]] || exit 1printf 'arguments verified\n'
Bash Reference