Zum Inhalt springen

Exit Codes & JSON Output

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

mdocker is built to be scriptable: predictable exit codes and machine-readable output where it matters.

Code Meaning
0 Success.
1 Generic error (an internal die).
2 Port-conflict pre-flight failed — no free replacement port could be found.

Exit code 2 is specific to up: if the pre-flight cannot find a free host port, the command aborts with 2 rather than starting a broken stack. To handle it, either free the port, or re-run with --auto-remap-ports (remap automatically) or --no-port-check (skip the check).

scripting exit codes
if mdocker up aurora; then
echo "started"
elif [ $? -eq 2 ]; then
echo "port conflict — retrying with auto-remap"
mdocker up aurora --auto-remap-ports
fi

Read-only verbs accept --json, which emits machine-readable output you can pipe into jq. The flag may be placed before the verb (mdocker --json git info aurora).

--json + jq
mdocker --json ls | jq -r '.[].name'
mdocker inspect aurora --json | jq '.[].connection'
mdocker git info aurora --json | jq '.branch, .dirty'

Verbs that support --json include ls, inspect, health, stats, edge status, edge logs, config show, config domain list, git info, share ls, profile list, profile validate, db list, terminal list and terminal tools.