Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Docker DCA Exam - Topic 3 Question 130 Discussion

Posted by Linn on Jul 21, 2026 at 08:25 PM

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

Solution. 'docker port inspect", docker container inspect"

Suggested Answer: B

The set of commandsdocker port inspectanddocker container inspectwill not identify the published port(s) for a container. The reason is that there is no such command asdocker port inspect.The correct command to inspect the port mappings of a container isdocker port1.The commanddocker container inspectcan also show the port mappings of a container, but it will display a lot of other information as well, so it isnot as concise asdocker port2. To identify the published port(s) for a container, you can use either of these commands:

docker port CONTAINERwill list all the port mappings of the container1.

docker port CONTAINER PRIVATE_PORTwill list only the port mapping of the specified private port of the container1.

docker container inspect --format=' { {.NetworkSettings.Ports}}' CONTAINERwill list only the port mappings of the container in a JSON format23.

For example, if you have a container namedwebthat publishes port 80 to port 8080 on the host, you can use any of these commands to identify the published port:

$ docker port web

80/tcp -> 0.0.0.0:8080

$ docker port web 80

0.0.0.0:8080

$ docker container inspect --format=' { {.NetworkSettings.Ports}}'web

map[80/tcp:[map[HostIp:0.0.0.0 HostPort:8080]]]

:

docker port

docker container inspect

How can I grab exposed port from inspecting docker container?


Get Premium DCA Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
12 comments · newest first
LA
Lavera 1 month ago
A) Yes, both commands provide port info.
JU
Justine 1 month ago
B) No, I don't think so.
TR
Trina 1 month ago
A) Yes, it can identify published ports.
EL
Elden 2 months ago
No way, I don't think that's right.
ST
Stevie 2 months ago
Wait, can you really use both commands?
GE
German 2 months ago
Definitely works for inspecting containers!
DI
Dierdre 2 months ago
I thought it was just 'docker port'?
KE
Kenda 2 months ago
Yes, it can identify published ports.
EL
Eliseo 2 months ago
I believe the answer is A, but I might be mixing up the commands. I should have reviewed that section more thoroughly.
CU
Curtis 3 months ago
I'm a bit confused; I thought "docker port inspect" was used for something else. Can it really identify published ports?
DE
Denise 3 months ago
I remember practicing with similar questions, and I feel like "docker container inspect" can definitely provide that info.
NI
Nichelle 3 months ago
I think the command should be able to show the published ports, but I'm not entirely sure if "docker port inspect" is the right syntax.
0/2000 characters

Save Cancel