Join the discussion
Question 5/42
After creating a new Docker network using the following command:
docker network create --driver bridge isolated_nw
which parameter must be added todocker createin order to attach a container to the network?
docker network create --driver bridge isolated_nw
which parameter must be added todocker createin order to attach a container to the network?
Correct Answer: D
Explanation
To attach a container to a network when creating it, the --network flag must be used with the name of the network as the argument. The --network flag specifies the network mode for the container. By default, the network mode is bridge, which means the container is connected to the default bridge network. However, if a custom network is created, such as isolated_nw in this case, the container must be explicitly attached to it using the --network flag. For example, to create a container named web1 and attach it to the isolated_nw network, the command would be:
docker create --name web1 --network isolated_nw nginx
The other options are not valid parameters for docker create. The --eth0, --ethernet, and --attach flags do not exist. The --alias flag is used to specify an additional network alias for the container on a user-defined network, but it does not attach the container to the network. References:
* docker network create | Docker Documentation1
* docker create | Docker Documentation
* Networking overview | Docker Docs2
To attach a container to a network when creating it, the --network flag must be used with the name of the network as the argument. The --network flag specifies the network mode for the container. By default, the network mode is bridge, which means the container is connected to the default bridge network. However, if a custom network is created, such as isolated_nw in this case, the container must be explicitly attached to it using the --network flag. For example, to create a container named web1 and attach it to the isolated_nw network, the command would be:
docker create --name web1 --network isolated_nw nginx
The other options are not valid parameters for docker create. The --eth0, --ethernet, and --attach flags do not exist. The --alias flag is used to specify an additional network alias for the container on a user-defined network, but it does not attach the container to the network. References:
* docker network create | Docker Documentation1
* docker create | Docker Documentation
* Networking overview | Docker Docs2
Add Comments
- Other Question (42q)
- Q1. Which of the following kinds of data cancloud-initprocess directly from user-data? (Choose...
- Q2. Which of the following statements about the commandlxc-checkpointis correct?...
- Q3. FILL BLANK What is the default path to the Docker daemon configuration file on Linux? (Spe...
- Q4. What is the purpose of the commandvagrant init?...
- Q5. After creating a new Docker network using the following command: docker network create --d...
- Q6. FILL BLANK What command is used to run a process in a new Linux namespace? (Specify ONLY t...
- Q7. In order to use the optiondom0_memto limit the amount of memory assigned to the Xen Domain...
- Q8. Which of the following statements are true regarding a Pod in Kubernetes? (Choose two.)...
- Q9. Which of the following commands executes a command in a running LXC container?...
- Q10. Which of the following statements are true regarding VirtualBox?...
- Q11. What is the purpose of the packer inspect subcommand?...
- Q12. Which CPU flag indicates the hardware virtualization capability on an AMD CPU?...
- Q13. Which of the following values would be valid in the FROM statement in aDockerfile?...
- Q14. What happens when the following command is executed twice in succession? docker run -tid -...
- Q15. How can data be shared between several virtual machines running on the same Linux-based ho...
- Q16. What is the purpose ofcloud-init?
- Q17. Ifdocker stackis to be used to run a Docker Compose file on a Docker Swarm, how are the im...
- Q18. How does Packer interact with system images?
- Q19. In an IaaS cloud, what is a common method for provisioning new computing instances with an...
- Q20. Which directory is used bycloud-initto store status information and configuration informat...
- Q21. Which of the following values are valid in thefirmwareattribute of a<os>element in a...
- Q22. What does IaaS stand for?
- Q23. If aDockerfilecontains the following lines: WORKDIR / RUN cd /tmp RUN echo test > test ...
- Q24. If aDockerfilecontains the following lines: WORKDIR / RUN cd /tmp RUN echo test > test ...
- Q25. Which of the following services can QEMU provide in a user network? (Choose three.)...
- Q26. Which of the following statements are true about container-based virtualization? (Choose t...
- Q27. What is true aboutcontainerd?
- Q28. In order to use the optiondom0_memto limit the amount of memory assigned to the Xen Domain...
- Q29. Which command within virsh lists the virtual machines that are running on the current host...
- Q30. Which of the following statements is true regarding the following output ofxl list: (Exhib...
- Q31. Which of the following services can QEMU provide in a user network? (Choose three.)...
- Q32. Which file in acgroupdirectory contains the list of processes belonging to thiscgroup?...
- Q33. Which of the following values are valid in the type attribute of a<domain>element in...
- Q34. Which of the following devices exist by default in an LXC container? (Choose three.)...
- Q35. Which of the following values would be valid in the FROM statement in aDockerfile?...
- Q36. FILL BLANK What LXC command lists containers sorted by their CPU, block I/O or memory cons...
- Q37. In an IaaS cloud, what is a common method for provisioning new computing instances with an...
- Q38. Which file format is used by libvirt to store configuration data?...
- Q39. Which of the following statements in aDockerfileleads to a container which outputs hello w...
- Q40. Which of the following commands boots a QEMU virtual machine using hardware virtualization...
- Q41. Which of the following tasks are part of a hypervisor's responsibility? (Choose two.)...
- Q42. What is the purpose of the commandvagrantinit?...
