Can this set of commands identify the published port(s) for a container?

Can this set of commands identify the published port(s) for a container?

Solution: docker container inspect’, ‘docker port’
A . Yes
B . No

Answer: A

Explanation:

The set of commands docker container inspect and docker port can identify the published port(s) for a container. The docker container inspect command returns low-level information about a container, including its network settings and port bindings1. The docker port command lists port mappings or a specific mapping for the container2. Both commands can show which host port is mapped to which container port, and the protocol used. For example, docker container inspect -f ‘{{.NetworkSettings.Ports}}’ container_name will show the port bindings for the container_name3. Similarly, docker port container_name will show the port mappings for the container_name.

Reference: docker container inspect

docker port

How to Expose and Publish Ports in Docker

[How to obtain the published ports from within a docker container?]

Latest DCA Dumps Valid Version with 55 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments