ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 129 - DCA discussion

Report
Export

You want to create a container that is reachable from its host's network.

Does this action accomplish this?

Solution. Use either EXPOSE or -publish to access the container on the bridge network.

A.

Yes

Answers
A.

Yes

B.

No

Answers
B.

No

Suggested answer: B

Explanation:

Using either EXPOSE or -publish to access the container on the bridge network will not accomplish the goal of creating a container that is reachable from its host's network.EXPOSE is a way of documenting which ports a container listens on, but it does not open any ports to the host1.-publish (or -p) is a way of mapping a host port to a container port, but it does not change the network mode of the container2.By default, Docker containers use the bridge network, which isolates them from the host network3.To create a container that is reachable from its host's network, you need to use the --network host option when running the container4.This will make the container share the host's network stack and have the same IP address as the host4.Reference:

1: Difference Between ''expose'' and ''publish'' in Docker | Baeldung on Ops

2: Deploy services to a swarm | Docker Docs

3: Bridge network | Docker Docs

4: Host network | Docker Docs

asked 08/11/2024
lance bonczkiewicz
31 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first