docker network 网络模式

安装Docker时,自动创建3个网络模式(bridge,host,none),另外和可以自己指定一个(container):

网络名
bridge
host
none

container模式不需要列出,因为是直接可容器共享ip

使用docker network ls查看docker自动创建的网络:

NETWORK ID          NAME                DRIVER              SCOPE
3c145f070fd7        bridge              bridge              local
f0428b4ac8ec        host                host                local
42c2aaaeac08        none                null                local

在创建容器时,可以通过--net参数指定模式:

模式 参数
bridge模式 使用 --net=bridge 指定,默认设置。
none模式 使用 --net=none 指定。
host模式 使用 --net=host 指定。
container模式 使用 --net=container:NAME_or_ID 指定。

参考:
https://www.cnblogs.com/zuxing/articles/8780661.html
https://blog.51cto.com/shyln/2133385

猜你喜欢

转载自blog.csdn.net/claroja/article/details/114781568