DCA · Question #114
You want to create a container that is reachable from its host's network. Does this action accomplish this? Solution: Use --link to access the container on the bridge network.
The correct answer is B. No. The --link option is used for inter-container communication on the same bridge network and does not expose a container to the host's network.
Question
You want to create a container that is reachable from its host's network. Does this action accomplish this? Solution: Use --link to access the container on the bridge network.
Options
- AYes
- BNo
How the community answered
(31 responses)- A13% (4)
- B87% (27)
Why each option
The `--link` option is used for inter-container communication on the same bridge network and does not expose a container to the host's network.
The `--link` option establishes a connection between containers and does not expose container ports to the host's network interface.
The `--link` option provides a legacy way for containers to discover and communicate with each other on the same bridge network using hostnames, but it does not expose the container's ports to the host machine. To make a container reachable from the host, port publishing (`-p` or `--publish`) is required.
Concept tested: Docker container network host reachability
Source: https://docs.docker.com/engine/reference/commandline/run/#link
Topics
Community Discussion
No community discussion yet for this question.