ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 36 - DCA discussion

Report
Export

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

Solution: docker container inspect', 'docker port'

A.

Yes

Answers
A.

Yes

B.

No

Answers
B.

No

Suggested answer: A

Explanation:

The set of commandsdocker container inspectanddocker portcan identify the published port(s) for a container.Thedocker container inspectcommand returns low-level information about a container, including its network settings and port bindings1.Thedocker portcommand 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_namewill show the port bindings for the container_name3. Similarly,docker port container_namewill 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?]

asked 08/11/2024
cristian vargas
42 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first