DCA · Question #116
You want to create a container that is reachable from its host's network. Does this action accomplish this? Solution: Use network attach to access the containers on the bridge network
The correct answer is B. No. Using docker network attach connects a container to an existing network, which facilitates inter-container communication but does not inherently expose container ports 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 network attach to access the containers on the bridge network
Options
- AYes
- BNo
How the community answered
(36 responses)- A11% (4)
- B89% (32)
Why each option
Using `docker network attach` connects a container to an existing network, which facilitates inter-container communication but does not inherently expose container ports to the host's network.
`docker network attach` connects a container to an internal network but does not expose its services to the host system.
The `docker network attach` command connects an existing container to a specified network, allowing it to communicate with other containers on that network. However, it does not, by itself, publish container ports to the host machine's network interface, which is required for host reachability.
Concept tested: Docker container network attachment vs. exposure
Source: https://docs.docker.com/engine/reference/commandline/network_attach/
Topics
Community Discussion
No community discussion yet for this question.