docker inspect -f '{{json .NetworkSettings.Ports}}' myapp

Category: Docker

docker inspect -f '{{json .NetworkSettings.Ports}}' myapp

Show a container's port mappings as JSON

Renders the published port mappings of myapp as raw JSON, showing host port, container port, and protocol. The {{json .}} template prints the whole settings object. Useful before scripting firewall or proxy config.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.