ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 127 - 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: B

Explanation:

The set of commandsdocker container inspectanddocker portcannot identify the published port(s) for a container.Thedocker container inspectcommand returns low-level information on a container, such as its ID, name, state, network settings, mounts, etc1.However, it does not show the port mappings between the container and the host2.Thedocker portcommand lists the port mappings or a specific mapping for a container, but it requires the container name or ID as an argument3.Therefore, to identify the published port(s) for a container, you need to use both commands together, such asdocker port $(docker container inspect -f '{{.Name}}' CONTAINER)4.Reference:

docker container inspect | Docker Docs

How to inspect a running Docker container - Stack Overflow

docker port | Docker Docs

List port for Docker container using command line - Stack Overflow

asked 08/11/2024
Wasawatt Ch
39 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first