Map resolved Compose services to images and published ports
Build a paste-ready command, then review its compatibility and effects before running it.
docker compose -f <file> config --format json | jq -r '.services | to_entries[] | [.key,.value.image,([.value.ports[]?.published] | join(","))] | @tsv'Complete required fields to copy the generated command.
read-onlyno known side effects Compatibility
Linux + macOS + WindowsVerified for Linux, macOS, Windows using bash, zsh, powershell syntax.
Operational knowledgereview due 2027-01-19
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 signalsapi registry.example.com/api:4.8.0 8080Representative 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 compose -f {{file}} config --format json | jq -r '.services | to_entries[] | [.key,.value.image,([.value.ports[]?.published] | join(","))] | @tsv'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.
02composeArgumentPasses compose to docker.
03-fOptionKeeps following new output or selects the command-specific force/file mode.
04<file>ParameterA value supplied in the Fill parameters section.
05configArgumentPasses config to docker.
06--formatOptionFormats each result using the supplied template.
07jsonArgumentPasses json to docker.
08|PipelinePasses the output on the left to the command on the right.
09jqCommandRuns the jq stage of this one-liner.
10-rOptionEnables raw, recursive, or reverse mode for this command.
11'.services | to_entries[] | [.key,.value.image,([.value.ports[]?.published] | join(","))] | @tsv'ArgumentPasses '.services | to_entries[] | [.key,.value.image,([.value.ports[]?.published] | join(","))] | @tsv' to jq.
This advanced community-curated one-liner combines several stages. Review every option and placeholder before running it.
Example input
docker compose -f compose.yaml config --format json | jq -r '.services | to_entries[] | [.key,.value.image,([.value.ports[]?.published] | join(","))] | @tsv'
Example output
api registry.example.com/api:4.8.0 8080
postgres postgres:16 5432
Illustrative output — exact values vary by system and data.
Official sources