I have checked videos and docs related to bridge network as well as overlay network, but I just can't find the difference. Both are used to create a connection between two networks. But what is the difference? When should I use bridge and when should I use overlay network?
Definition. An overlay network is a communication network constructed on top of an another communication network. The nodes of the overlay network are interconnected with logical connections, which form an overlay topology.
This provides better isolation and interoperability between containers, and custom bridge networks have better security and features than the default bridge. All containers in a custom bridge can communicate with the ports of other containers on that bridge.
The overlay network driver creates a distributed network among multiple Docker daemon hosts. This network sits on top of (overlays) the host-specific networks, allowing containers connected to it (including swarm service containers) to communicate securely when encryption is enabled.
In terms of Docker, a bridge network uses a software bridge which allows containers connected to the same bridge network to communicate, while providing isolation from containers which are not connected to that bridge network.
Bridge networks connect two networks while creating a single aggregate network from multiple communication networks or network segments, hence the name bridge.
In the above image Station A and Station B are connected by a bridge. Thus by using the bridge we aggregated both network in a single unit (on a high level). Bridge can even be used to create connection between networks on same host. This is generally required if the host is running multiple VM's or containers.
Overlay networks are usually used to create a virtual network between two separate hosts. Virtual, since the network is build over an existing network.
In the above image host A and host B are connected over an external network and an overlay network is built over that network. For example initially internet was built as an overlay over telephone lines, but now many telephone networks (using VoIP) are an overlay over internet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With