20 lines
737 B
Bash
Executable File
20 lines
737 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Fake docker: answers read from files in $STUB_DOCKER_DIR.
|
|
set -euo pipefail
|
|
printf 'docker %s\n' "$*" >>"$STUB_LOG"
|
|
d="${STUB_DOCKER_DIR:-/nonexistent}"
|
|
case "$1 ${2:-}" in
|
|
"version --format") echo "29.0.0" ;;
|
|
"ps -q") cat "$d/ps" 2>/dev/null || true ;;
|
|
"inspect --format") cat "$d/inspect" 2>/dev/null || true ;;
|
|
"network ls")
|
|
case "$*" in
|
|
*driver=macvlan*) cat "$d/macvlan" 2>/dev/null || true ;;
|
|
*driver=ipvlan*) cat "$d/ipvlan" 2>/dev/null || true ;;
|
|
*driver=bridge*) cat "$d/bridges" 2>/dev/null || true ;;
|
|
esac
|
|
;;
|
|
"network inspect") grep -- "^${*: -1} " "$d/subnets" 2>/dev/null | cut -d' ' -f2- || true ;;
|
|
*) exit 1 ;;
|
|
esac
|