When installing Docker, 3 network modes (bridge, host, none) are automatically created, and you can specify one (container) yourself:
Network name |
---|
bridge |
host |
none |
container
The mode does not need to be listed, because the container can share the ip directly
Use to docker network ls
view the network automatically created by docker:
NETWORK ID NAME DRIVER SCOPE
3c145f070fd7 bridge bridge local
f0428b4ac8ec host host local
42c2aaaeac08 none null local
When creating a container, you can --net
specify the mode through parameters:
mode | parameter |
---|---|
bridge mode | Use --net=bridge to specify, the default setting. |
none mode | Use --net=none to specify. |
host mode | Use --net=host to specify. |
container mode | Use --net=container:NAME_or_ID to specify. |
Reference:
https://www.cnblogs.com/zuxing/articles/8780661.html
https://blog.51cto.com/shyln/2133385