下面一些参数是在执行docker run时,提供给具体容器的:
--net=bridge/none/container/hostdocker
'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 stackide
'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.this
--net用于指定容器使用的网络通讯方式,它能够取下面四个值:spa
bridge:这个Docker中的容器默认的方式容器
none:容器没有网络栈,也就是说容器没法与外部通讯。配置
container:<name|id>:使用其余容器(name或者id指定)的网络栈。实际上,Docker会将该容器加入指定容器的network namespace,这是一种很是有用的方式。network
host:表示容器使用Host的网络,没有本身独立的网络栈。实际上,在这种状况下,Docker不会给容器建立单独的网络名字空间(network namespace)。因为容器能够彻底访问Host的网络,因此此方式也是不安全的。service