1. 程式人生 > >docker的網絡模式

docker的網絡模式

ren 一起 網絡 但是 .com core 運行 回顧 erl

記性不好忘記了,回顧一下。按照慣例,直接看官文。

Docker’s networking subsystem is pluggable, using drivers. Several drivers exist by default, and provide core networking functionality.

bridge: The default network driver. If you don’t specify a driver, this is the type of network you are creating. Bridge networks are usually used when your applications run in standalone containers that need to communicate. User-defined bridge networks are best when you need multiple containers to communicate on the same Docker host.

host: For standalone containers, remove network isolation between the container and the Docker host, and use the host’s networking directly. host is only available for swarm services on Docker 17.06 and higher. Host networks are best when the network stack should not be isolated from the Docker host, but you want other aspects of the container to be isolated.

overlay: Overlay networks connect multiple Docker daemons together and enable swarm services to communicate with each other. Overlay networks are best when you need containers running on different Docker hosts to communicate, or when multiple applications work together using swarm services.

macvlan: Macvlan networks allow you to assign a MAC address to a container, making it appear as a physical device on your network. The Docker daemon routes traffic to containers by their MAC addresses.

none: For this container, disable all networking. none is not available for swarm services.

docker的網絡子系統是插件化的,需要使用驅動。默認支持以下幾種驅動:

  • bridge:橋接,默認的網絡驅動,如果不指定驅動,將默認使用橋接。通常用在同一個docker主機中的多個容器間通信。
  • host:去掉容器和宿主機之間的網絡隔離,直接使用宿主機的網絡。通常用在網絡不與宿主機隔離但是其他資源需要隔離的場景。
  • overlay:疊加網絡,將多個docker daemon連接到一起。主要用在運行在不同宿主機上的容器間通信。
  • macvlan:允許為容器分配一個MAC地址,讓它成為一個物理設備。
  • none:禁用網絡。swarm不支持。

參考:
https://docs.docker.com/network/

docker的網絡模式