Exit Codes & JSON Output
mdocker is built to be scriptable: predictable exit codes and machine-readable
output where it matters.
Exit codes
Section titled “Exit codes”| 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).
if mdocker up aurora; then echo "started"elif [ $? -eq 2 ]; then echo "port conflict — retrying with auto-remap" mdocker up aurora --auto-remap-portsfiJSON output
Section titled “JSON output”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).
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.
Related
Section titled “Related”Cookie settings
We only use statistics tools if you allow it. Necessary storage keeps this site working; everything else is off until you decide.
Stores your choice from this dialog in your browser (localStorage). No cookie, no transfer to third parties.
Google Analytics 4 via Google Tag Manager, to measure how the site is used. Loaded only after you allow it.