Show the active Docker context and endpoint
Build a paste-ready command, then review its compatibility and effects before running it.
docker context show && docker context inspect --format '{{json .Endpoints.docker.Host}}' "$(docker context show)"read-onlyno known side effects Compatibility
Linux + macOS + WindowsVerified for Linux, macOS, Windows using bash, zsh, powershell syntax.
Operational knowledgereview due 2027-01-20
Requirementsdockerdocker must be installed and available on PATH.
Version supportdocker Current supported releasesVerified for linux, macos, windows using bash, zsh, powershell syntax; consult compatibility notes for platform-specific differences.
Expected signalsdefaultRepresentative successful output; values vary with the selected target and system state.
Known errorsdocker: command not founddocker is missing or is not available on PATH.
Verifydocker context show && docker context inspect --format '{{json .Endpoints.docker.Host}}' "$(docker context show)"The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01dockerCommandRuns the docker stage of this one-liner.
02contextArgumentPasses context to docker.
03showArgumentPasses show to docker.
04&&Conditional operatorRuns the next command only when the previous command succeeds.
05dockerCommandRuns the docker stage of this one-liner.
06contextArgumentPasses context to docker.
07inspectArgumentPasses inspect to docker.
08--formatOptionFormats each result using the supplied template.
09'{{json .Endpoints.docker.Host}}'ArgumentPasses '{{json .Endpoints.docker.Host}}' to docker.
10"$(docker context show)"ArgumentPasses "$(docker context show)" to docker.
Example input
docker context show && docker context inspect --format '{{json .Endpoints.docker.Host}}' "$(docker context show)"
Example output
default
"unix:///var/run/docker.sock"
Illustrative output — exact values vary by system and data.
Official sources