nerdexam
LPI

305-300 · Question #88

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 correct answer is D. --network=isolated_nw. 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…

Containerization

Question

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?

Options

  • A--eth0=isolated_nw
  • B--alias=isolated_nw
  • C--ethernet=isolated_nw
  • D--network=isolated_nw
  • E--attach=isolated_nw

How the community answered

(31 responses)
  • A
    10% (3)
  • B
    3% (1)
  • D
    84% (26)
  • E
    3% (1)

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

Topics

#Docker networking#bridge network#--network flag#docker create

Community Discussion

No community discussion yet for this question.

Full 305-300 Practice