{"id":2848,"date":"2020-05-05T19:42:06","date_gmt":"2020-05-05T14:12:06","guid":{"rendered":"https:\/\/opstree.com\/blog\/\/?p=2848"},"modified":"2026-01-05T15:51:26","modified_gmt":"2026-01-05T10:21:26","slug":"docker-networking-containers-communication","status":"publish","type":"post","link":"https:\/\/opstree.com\/blog\/2020\/05\/05\/docker-networking-containers-communication\/","title":{"rendered":"Docker Networking &#8211; Containers Communication"},"content":{"rendered":"\r\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"457\" class=\"wp-image-2887\" src=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2020\/05\/image.png?w=706\" alt=\"\" \/><\/figure>\r\n\r\n\r\n\r\n<p>In the modern world, the container is a fascinating technology, as it has revolutionized software development and delivery. Everyone is using containers because of its dynamic, scalable, and isolated nature.<\/p>\r\n\r\n\r\n\r\n<p>People do use some orchestration software such as Kubernetes, Openshift, Docker Swarm, and AWS ECS, etc to run their production workloads on containers.<\/p>\r\n\r\n\r\n\r\n<p>But the question is how these containers communicate with each other in various situations?<!--more--><\/p>\r\n\r\n\r\n\r\n<p>Well, that comes through Docker networking. So in this blog, we will be discussing the docker networking goals, architecture, and types.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">Docker Networking<\/h2>\r\n\r\n\r\n\r\n<p>Essentially, docker networking is used to create communication between the docker containers and the outside world via host machine or you might say that this is a communication passage through which all the isolated containers communicate with each other in different situations to perform the required acts.<\/p>\r\n\r\n\r\n\r\n<p>In other words, if we run different workloads on the docker, there should be a communication mechanism through which applications\/workloads will interact with each other. For eg, if we have 3-tier application i.e. frontend, backend and database and all of these run on a single host machine, then we will need a simple docker network but what if workloads are running on different machines, in that case, we would need a different type of docker network.<\/p>\r\n\r\n\r\n\r\n<p>So docker provides different types of docker networks and we can leverage them as per our needs.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">Goals of Docker Networking<\/h2>\r\n\r\n\r\n\r\n<p>There are lots of benefits\/goals of docker networking but we will highlight some key points only.<\/p>\r\n\r\n\r\n\r\n<div class=\"wp-block-image\">\r\n<figure class=\"alignleft size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2859\" src=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2020\/05\/business.png?w=512\" alt=\"\" width=\"67\" height=\"67\" \/><\/figure>\r\n<\/div>\r\n\r\n\r\n\r\n<p><strong>Flexibility:- <\/strong>It gives you the flexibility to run any number of container workloads\/applications on any sort of infrastructure, such as multi-cloud, hybrid cloud, or single cloud.<\/p>\r\n\r\n\r\n\r\n<div class=\"wp-block-image\">\r\n<figure class=\"alignleft size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2862\" src=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2020\/05\/technology.png?w=512\" alt=\"\" width=\"59\" height=\"59\" \/><\/figure>\r\n<\/div>\r\n\r\n\r\n\r\n<p><strong> Cross-Platform:- <\/strong>Containers can interact through multi-platforms without having depending on the server&#8217;s size or operating system.<\/p>\r\n\r\n\r\n\r\n<div class=\"wp-block-image\">\r\n<figure class=\"alignleft size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2866\" src=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2020\/05\/up-arrow.png?w=512\" alt=\"\" width=\"67\" height=\"67\" \/><\/figure>\r\n<\/div>\r\n\r\n\r\n\r\n<p><strong>Scalability:- <\/strong>Docker networking lets you grow and scale your applications without affecting application efficiency.<\/p>\r\n\r\n\r\n\r\n<p>&nbsp;<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">Types of Networking<\/h2>\r\n\r\n\r\n\r\n<p>Docker offers multiple networking types that can be exploited\/leveraged according to our requirements or scenarios. But we will be talking about the Bridge, Host and, Overlay networks.<\/p>\r\n\r\n\r\n\r\n<div class=\"wp-block-image\">\r\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"492\" height=\"282\" class=\"wp-image-2873\" src=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2020\/05\/bridge.png?w=492\" alt=\"\" \/><\/figure>\r\n<\/div>\r\n\r\n\r\n\r\n<p><strong>Bridge:- <\/strong>The bridge network is a private internal default network, built on the host by the docker. Each container has an internal IP address and can reach other container using this internal IP. Bridge networks are typically used when the applications run in containers needs to communicate on standalone setup.<\/p>\r\n\r\n\r\n\r\n<p>A Bridge network is like a software device that interacts with the host machine&#8217;s kernel to create a software bridge network that allows containers to communicate with each other. It creates a virtual network between host and containers which perform all the network address translations(NAT).<\/p>\r\n\r\n\r\n\r\n<div class=\"wp-block-image\">\r\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"382\" height=\"252\" class=\"wp-image-2877\" src=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2020\/05\/host.png?w=382\" alt=\"\" \/><\/figure>\r\n<\/div>\r\n\r\n\r\n\r\n<p><strong>Host:-<\/strong> This driver removes the network isolation between the docker host and the docker containers for direct use of host networking. But with this, you will not be able to run multiple containers on the same host, on the same port as all containers in the host network will have common ports of the host system.<\/p>\r\n\r\n\r\n\r\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\r\n<p>Containers that are running with the host network share&#8217;s host networking namespace. The network performance would be better in this networking because it doesn&#8217;t require NAT.<\/p>\r\n<\/blockquote>\r\n\r\n\r\n\r\n<div class=\"wp-block-image\">\r\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"452\" height=\"292\" class=\"wp-image-2879\" src=\"https:\/\/opstree.com\/blog\/\/wp-content\/uploads\/2020\/05\/overlay.png?w=452\" alt=\"\" \/><\/figure>\r\n<\/div>\r\n\r\n\r\n\r\n<p><strong>Overlay:-<\/strong> The overlay driver is designed to enable communication between docker containers in different networks that are hidden from each other. Those networks may be public or private. If there are two hosts and each one runs a docker, the Overlay network will help to create a subnet at the top of these two hosts and each container connected to this Overlay network will be able to communicate with other containers.<\/p>\r\n\r\n\r\n\r\n<p>For creating an overlay network, we need a key\/value store where all host system&#8217;s containers information will be stored for communication, for example:- zookeeper, etcd, or consul. <br \/>Also, overlay network sits over the top of host networks, some firewall level configuration will also be required. If you want to setup a secure overlay network, you can enable the IPSec encryption. We will see this in-depth in our next blog on overlay networking.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\r\n\r\n\r\n\r\n<p>Since containers and docker are becoming so much popular, communities are developing tools for it. Some of the docker network tools are:- <a href=\"https:\/\/github.com\/coreos\/flannel#flannel\" target=\"_blank\" rel=\"noreferrer noopener\">Flannel<\/a>,<a href=\"http:\/\/docs.projectcalico.org\/\" target=\"_blank\" rel=\"noopener\"> Project Calico<\/a>, Weave net.<\/p>\r\n\r\n\r\n\r\n<p>But mostly these tools are to manage overlay networks with Kubernetes or some other orchestrator, so we&#8217;ll build an overlay network in our next blog without any orchestration tool to make the idea of docker networking clearer.<\/p>\r\n\r\n\r\n\r\n<p>Now I am assuming you guys have a basic understanding about docker networking.<\/p>\r\n\r\n\r\n\r\n<p>Thanks for reading, I\u2019d really appreciate any and all feedback, please leave your comment below if you guys have any feedback.<\/p>\r\n\r\n\r\n\r\n<p>Cheers till next time!!<\/p>\r\n\r\n\r\n\r\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\r\n<div class=\"wp-block-button\">\r\n<p>&nbsp;<\/p>\r\n<p>Opstree is an End to End DevOps solution provider<\/p>\r\n<p>\r\n\r\n<\/p>\r\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\r\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link\" title=\"https:\/\/www.opstree.com\/contact-us\" href=\"https:\/\/www.opstree.com\/contact-us\" target=\"_blank\" rel=\"noopener\">contact us<\/a><\/div>\r\n<\/div>\r\n<\/div>\r\n<\/div>\r\n\r\n<p>&nbsp;<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>In the modern world, the container is a fascinating technology, as it has revolutionized software development and delivery. Everyone is using containers because of its dynamic, scalable, and isolated nature. People do use some orchestration software such as Kubernetes, Openshift, Docker Swarm, and AWS ECS, etc to run their production workloads on containers. But the &hellip; <a href=\"https:\/\/opstree.com\/blog\/2020\/05\/05\/docker-networking-containers-communication\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Docker Networking &#8211; Containers Communication&#8221;<\/span><\/a><\/p>\n","protected":false},"author":89038429,"featured_media":29900,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[28070474,4504191],"tags":[182564,780,768739308,768739305,768739290,1381659],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/opstree.com\/blog\/wp-content\/uploads\/2025\/11\/DevSecOps-1.jpg","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pfDBOm-JW","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/2848"}],"collection":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/users\/89038429"}],"replies":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/comments?post=2848"}],"version-history":[{"count":25,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/2848\/revisions"}],"predecessor-version":[{"id":30279,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/posts\/2848\/revisions\/30279"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/media\/29900"}],"wp:attachment":[{"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/media?parent=2848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/categories?post=2848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opstree.com\/blog\/wp-json\/wp\/v2\/tags?post=2848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}