Docker’s Network Configuration


Network Configuration of Container

The following parameters are provided to specific containers when docker run is executed:

  • ‘bridge’: creates a new network stack for the container on the docker bridge

  • ‘none’: no networking for this container

  • ‘container:<name|id>’: reuses another container network stack

  • ‘host’: use the host network stack inside the container. Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.


–net is used to specify the network communication method used by the container. It can take the following four values:

  • Bridge: The default method for containers in this Docker

  • None: The container does not have a network stack, which means the container cannot communicate with the outside.

  • Container: < name | id >: network stack using another container (name or id specified). In fact, Docker will add the container to the specified container’s network namespace, which is a very useful way.

  • Host: Indicates that the container uses Host’s network and does not have its own independent network stack. In fact, in this case, Docker will not create a separate network namespace for the container. Since the container has full access to the Host’s network, this method is also unsafe.