305-300 practice question 6 of 15
After creating a new Docker network using the following command: docker network create --driver bridge isolated_nw which parameter must be added to docker create in order to attach a container to the network?
Full set: 121 questionsTo attach a container to a specific, user-defined network at creation time, the --network flag is used with the docker create or docker run command. This flag takes the name or ID of the target network as its argument. In this scenario, the network is named isolatednw, so the correct parameter is --network=isolatednw. This connects the container's network stack to the specified bridge network, allowing it to communicate with other containers on the same network using their names as hostnames.
--eth0=isolatednw: This is not a valid Docker CLI option for specifying a network connection. --alias=isolatednw: This option sets a network-scoped alias for a container but does not attach it to the network; it is used in conjunction with --network. --ethernet=isolatednw: This is not a valid Docker CLI option. --attach=isolatednw: This flag is used to attach the local standard input, output, and error streams to a running container, not for network configuration.
1. Docker Inc. Official Documentation, docker run command reference: The documentation explicitly lists the --network option. It states, "Connect a container to a network." The usage examples show how to connect a container to a user-defined bridge network. (See section: "Network settings", --network option).
Source: Docker Docs, docs.docker.com/engine/reference/commandline/run/#network-settings
2. Docker Inc. Official Documentation, Networking with standalone containers: This guide details how to use user-defined bridge networks and confirms the use of docker run --network= ... to connect a container to a specific network upon startup.
Source: Docker Docs, docs.docker.com/network/network-tutorial-standalone/#use-user-defined-bridge-networks
3. Cornell University, CS 5356: "Startup-Scale System Design", Lecture 10: Containers & Docker: The course slides demonstrate container creation and networking. Slide 28 explicitly shows the command docker run --network my-net ... to connect a container to a custom network named my-net.
Source: Cornell University, www.cs.cornell.edu/courses/cs5356/2020sp/slides/10-docker.pdf, Slide 28.
Keep practicing
Take the free 305-300 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other 305-300 practice questions
- Question 1Which of the following devices exist by default in an LXC container? (Choose three.)
- Question 2Which functionality is provided by Vagrant as well as by Docker? (Choose three.)
- Question 3A clone of a previously used virtual machine should be created. All VM specific informati…
- Question 4Which of the following mechanisms are used by LXC and Docker to create containers? (Choos…
- Question 5Which of the following values are valid in the firmware attribute of a element in a libvi…
- Question 7Which of the following commands boots a QEMU virtual machine using hardware virtualizatio…
