Docker·57 questions

What is Docker App Containerization and how to use overlay networks to connect containers on different hosts?

Answer

When infrastructure grows beyond a single physical or virtual server, the standard Docker bridge network is no longer sufficient. To ensure secure and stable communication between containers running on completely different physical machines, overlay networks are used. This technology creates a virtual network layer on top of the existing physical infrastructure using traffic encapsulation.

Overlay networks work based on built-in orchestration mechanisms, such as Docker Swarm, or third-party network plugins, including Calico and Flannel. They use the VXLAN protocol to wrap container data packets into regular UDP packets, which are seamlessly transmitted between physical hosts via standard network interfaces.

The process of setting up distributed communication looks like this:

Initializing the orchestration cluster on the main manager node and connecting worker nodes to it.
Creating a distributed network of the overlay type using a special network management command and specifying a unique name.
Deploying services and attaching them to the created overlay network, which forces the managing daemon to automatically configure routing rules.
Using a built-in name resolution mechanism that allows containers to find each other by service names without binding to specific IP addresses.
Monitoring network activity and checking end-to-end port accessibility between isolated infrastructure nodes.

The main advantage of overlay networks is complete transparency for developers. The application does not need to know which physical server the adjacent microservice is running on, as the network layer takes care of all the work regarding traffic encapsulation, routing, and encryption. This allows scaling complex distributed systems to any number of machines without changing the application's source code.

Was this answer helpful?

More questions in this topic

Related questions from other topics