docker image inspect --format '{{json .Config.ExposedPorts}}' myapp

Category: Docker

docker image inspect --format '{{json .Config.ExposedPorts}}' myapp

Show an image's exposed ports as JSON

Renders the EXPOSE metadata of the image as raw JSON, showing which ports the image declares. The {{json .}} template prints the whole config object. Useful for wiring docker run -p mappings.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.