DCA · Question #79
Can this set of commands identify the published port(s) for a container? Solution: docker container inspect', 'docker port'
The correct answer is A. Yes. Both docker container inspect and docker port are effective commands for identifying the published port mappings of a Docker container.
Question
Can this set of commands identify the published port(s) for a container? Solution: docker container inspect', 'docker port'
Options
- AYes
- BNo
How the community answered
(26 responses)- A85% (22)
- B15% (4)
Why each option
Both `docker container inspect` and `docker port` are effective commands for identifying the published port mappings of a Docker container.
The `docker container inspect` command provides a comprehensive JSON output that includes the container's network settings and port bindings, making it suitable for finding published ports. Additionally, `docker port` is a specialized command designed to directly list all mapped ports for a given container, efficiently showing the container-to-host port mappings.
Both `docker container inspect` and `docker port` are fully capable and widely used commands for retrieving information about a container's published ports.
Concept tested: Identifying Docker container published ports
Source: https://docs.docker.com/engine/reference/commandline/container_inspect/
Topics
Community Discussion
No community discussion yet for this question.