<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Farhim Ferdous</title>
    <description>The latest articles on DEV Community by Farhim Ferdous (@alubhorta).</description>
    <link>https://dev.to/alubhorta</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F522549%2Fb3b86a9c-a2e9-447a-b6f3-aeb796b12e67.JPG</url>
      <title>DEV Community: Farhim Ferdous</title>
      <link>https://dev.to/alubhorta</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alubhorta"/>
    <language>en</language>
    <item>
      <title>What is a Server?</title>
      <dc:creator>Farhim Ferdous</dc:creator>
      <pubDate>Tue, 24 Jan 2023 14:07:11 +0000</pubDate>
      <link>https://dev.to/alubhorta/what-is-a-server-2bpe</link>
      <guid>https://dev.to/alubhorta/what-is-a-server-2bpe</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Servers 101: Understanding What It Is, Why It Matters &amp;amp; More&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Originally published &lt;a href="https://techmormo.com/posts/what-is-a-server/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;How are you able to access any website on the Internet? What is the backbone of modern networks that Businesses and Governments rely upon?&lt;/p&gt;

&lt;p&gt;Yes, Servers.&lt;/p&gt;

&lt;p&gt;But what exactly are they and how do they work?&lt;/p&gt;

&lt;p&gt;Keep reading to find out!&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this blog, we will learn all about Servers including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;What is a Server?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Why should we learn about Servers?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Why do they exist?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Server Computers VS Desktop Computers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How do they work?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Types of Servers&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s begin by answering…&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Server?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;A Server is a computer program that provides some resources or functionality to other computer programs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flvoqcsvfaitpfdux4cdf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flvoqcsvfaitpfdux4cdf.png" alt="-" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a figure of speech, the computers running the server programs are often also referred to as servers. Although that’s technically incorrect.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why should we learn about Servers?
&lt;/h2&gt;

&lt;p&gt;Servers play a vital role in the information age of today. The following are the main benefits of learning about Servers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;HIGH PAYING Jobs: Understanding servers and how they work can open up job opportunities in IT, especially DevOps that pay top dollar!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cloud Computing: Due to the enormous business value, many companies are moving their data and applications to remote servers offered by AWS, Azure, GCP, etc. A key part of Cloud Computing is - Servers. Thus, mastering them can be a valuable skill for anyone interested in working in the technology industry.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Security: Servers are often the target of cyber attacks, so understanding how to secure them and protect against potential threats is essential.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Improved performance: By understanding how servers work and how to manage them, you can optimize performance and speed up your website, application, or service.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cost-effectiveness: By understanding servers, you can make better-informed decisions about the hardware and software you use, which can help lower costs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Automation: Many server management tasks are repetitive and toilsome. Automating tasks such as configuration and deployment can save time and reduce human error.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scalability: Knowing how to set up and manage servers allows you to easily scale your infrastructure to meet the needs of a growing user base.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Yes, learning about servers is surely advantageous.&lt;/p&gt;

&lt;p&gt;But, you may ask…&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do Servers exist?
&lt;/h2&gt;

&lt;p&gt;Servers exist to provide a centralized location for storing, managing, and distributing resources and information.&lt;/p&gt;

&lt;p&gt;The origins of servers can be traced back to the 1960s when mainframe computers were used by large organizations to store and manage data. These early servers were large and expensive, and were primarily used by government agencies and large corporations.&lt;/p&gt;

&lt;p&gt;As technology advanced, servers became smaller, more powerful, and more affordable. This led to the widespread adoption of servers in various industries, including business, education, healthcare, and government.&lt;/p&gt;

&lt;p&gt;Today, servers form the foundation of modern networks like the Internet, enabling the ability to connect with people and resources worldwide. There is no doubt they play a crucial role in the functioning of businesses, and industries of all kinds. Without servers, the efficient and effective functioning of these systems would not be possible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Server Computers VS Desktop Computers
&lt;/h2&gt;

&lt;p&gt;Server computers are quite different from desktop computers that we usually use at home or work. Although both types share similarities, they have major differences in terms of their design, capabilities, and intended use.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx1u0r5owyegdgyf7p3xn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx1u0r5owyegdgyf7p3xn.png" alt="-" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server computers&lt;/strong&gt; are generally packed in data centers for heat and efficiency. They are often virtualized to handle the shared needs of multiple users and projects. These machines are designed to handle heavy workloads and large amounts of requests and data. They typically have high-performance specifications and are built to run 24/7, ensuring high availability and fault-tolerance. Additionally, servers often have redundancy built in, ensuring that if one component fails, another can take its place, minimizing downtime and disruption to users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Desktop computers&lt;/strong&gt;, on the other hand, are designed for personal use by a single user and are typically used for tasks such as word processing, internet browsing, gaming, etc. These computers are not built to handle heavy workloads and data like servers computers. Instead, they are intended for more basic, everyday use and are usually only needed for a few hours a day. They come in a variety of forms and specifications, and can be customized to fit a user's specific needs and preferences.&lt;/p&gt;

&lt;p&gt;Ok, so…&lt;/p&gt;

&lt;h2&gt;
  
  
  How do Servers Work?
&lt;/h2&gt;

&lt;p&gt;Servers work by running specialized software programs that allow them to handle multiple requests simultaneously.&lt;/p&gt;

&lt;p&gt;‘Servers’ are devices or programs that store and distribute resources. ‘Clients’ are Devices or programs that consume those resources by requesting the servers. Together, this architecture is called the ‘Client-Server Model’.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9vfgwdugbm58zprf6wcd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9vfgwdugbm58zprf6wcd.png" alt="-" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When a client requests some information or resources from a server, the server processes the request and sends the information or resources back to the client. This forms the ‘Request-Response Cycle’.&lt;/p&gt;

&lt;p&gt;Take for example Google Search. When you search for something on Google, your browser as the ‘client’ sends a ‘request’ to Google. When a server from Google gets the request over the Internet, it performs its logic/function and sends your browser a ‘response’, which you see as search results.&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of Servers
&lt;/h2&gt;

&lt;p&gt;There are numerous types of servers, each with a specific purpose. Some of the most common types include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Web servers: These servers distribute web pages and documents that are typically consumed by web browsers. Example: Apache, Nginx.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Database servers: These servers store and manage large amounts of data, such as online transactions, inventory, customer information, etc. Example: MySQL, MongoDB.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;File servers: These servers store and manage files, such as documents, images, and videos. Example: FileZilla.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mail servers: These servers manage and distribute email messages.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Print servers: These servers manage and distribute print jobs to connected printers.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And countless other types.&lt;/p&gt;

&lt;p&gt;You are probably interacting with a server right now!&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Servers have come a long way since the 1960s and have become an essential component of modern networks. Learning about servers can open up job opportunities in fields such as IT and DevOps. It is also becoming increasingly important for businesses and organizations of all sizes.&lt;/p&gt;

&lt;p&gt;If you're interested in delving deeper into the world of servers and Cloud Computing, be sure to subscribe to the TechMormo Newsletter for more valuable DevOps content.&lt;/p&gt;

&lt;p&gt;Thanks for making it so far!&lt;/p&gt;

&lt;p&gt;We have a LOT more exciting DevOps content on the way! 🙌&lt;/p&gt;

&lt;p&gt;See you at the next one.&lt;/p&gt;

&lt;p&gt;Till then…&lt;/p&gt;

&lt;p&gt;Be bold and keep learning.&lt;/p&gt;

&lt;p&gt;But most importantly,&lt;/p&gt;

&lt;p&gt;Tech care!&lt;/p&gt;




&lt;p&gt;Subscribe to &lt;a href="https://techmormo.com/newsletter/" rel="noopener noreferrer"&gt;TechMormo Newsletter&lt;/a&gt; for cutting-edge DevOps content! 🚀&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>learning</category>
      <category>security</category>
      <category>beginners</category>
    </item>
    <item>
      <title>What is DevOps?</title>
      <dc:creator>Farhim Ferdous</dc:creator>
      <pubDate>Tue, 24 Jan 2023 13:50:11 +0000</pubDate>
      <link>https://dev.to/alubhorta/what-is-devops-14g4</link>
      <guid>https://dev.to/alubhorta/what-is-devops-14g4</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Really understand what DevOps is and the massive opportunities it offers!&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Originally published &lt;a href="https://techmormo.com/posts/what-is-devops/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;br&gt;
Link to video: &lt;a href="https://www.youtube.com/watch?v=cHxMaoe8DL0" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=cHxMaoe8DL0&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;What the heck is DevOps?&lt;/p&gt;

&lt;p&gt;And why is the demand for DevOps Engineers growing even faster than for Machine Learning or Data Science jobs?&lt;/p&gt;

&lt;p&gt;Keep reading to find out…&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Here’s the agenda for this tutorial:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;What is DevOps?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Common DevOps Practices&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Core DevOps Technologies&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Why learn DevOps?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;“Do I HAVE to be a ‘DevOps Engineer’?”&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Challenges in learning DevOps&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How TechMormo can help master DevOps&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ok, let’s first answer…&lt;/p&gt;

&lt;h2&gt;
  
  
  What is DevOps?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;DevOps is a concept aimed to deliver better software faster by uniting Software Development (Dev) and Operations (Ops).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The Dev team is responsible for product development, whereas the Ops is responsible for running systems smoothly.&lt;/p&gt;

&lt;p&gt;Traditionally these teams have worked separately with conflicting interests.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpqed2v5r8g6c1lhskt6i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpqed2v5r8g6c1lhskt6i.png" alt="1" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Dev team wants to move fast, release new features, and fix bugs.&lt;/p&gt;

&lt;p&gt;The Ops team, on the other hand, wants to move slowly and reduce changes to keep things stable.&lt;/p&gt;

&lt;p&gt;This conflict of interests used to cause a great deal of tension within organizations, negatively impacting the product.&lt;/p&gt;

&lt;p&gt;DevOps breaks down the proverbial walls within organizations so that teams can communicate and collaborate better.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbwj96jy21iboam5b63bk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbwj96jy21iboam5b63bk.png" alt="2" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By embracing a set of practices, tools, and cultural changes, DevOps provides faster releases, faster feedback from customers, and ultimately better software.&lt;/p&gt;

&lt;h2&gt;
  
  
  DevOps Practices
&lt;/h2&gt;

&lt;p&gt;DevOps is a broad and abstract topic. Different companies implement it differently.&lt;/p&gt;

&lt;p&gt;But most teams that embrace DevOps usually have a few practices in common:&lt;/p&gt;

&lt;h3&gt;
  
  
  1) Break down organizational silos to empower cross-functional teams
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fse4hzh35vcuiow4qpzjl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fse4hzh35vcuiow4qpzjl.png" alt="-" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This enables better communication and collaboration between teams in an organization. It also promotes self-sufficiency enabling teams to develop and deploy their products/services independently. Ultimately, the organization gains unrivaled agility.&lt;/p&gt;

&lt;h3&gt;
  
  
  2) Release short and incremental changes
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frolnviniy4vguxrhr9p5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frolnviniy4vguxrhr9p5.png" alt="-" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Inspired by Agile methods, this practice is key to being quick in an ever-changing industry. Short, incremental changes are faster to develop, review and ship. It also helps to resolve sudden incidents faster when deploying a small change, as opposed to when deploying 10,000 lines of code and multiple breaking changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  3) Adopt microservice architectures
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdk5ggqy1i92jmoybgkr3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdk5ggqy1i92jmoybgkr3.png" alt="-" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you have multiple teams able to own the entire lifecycle of their projects, you naturally get many small loosely-coupled services talking to each other ie. microservices. Although, this is not a necessity, esp. for small companies that can benefit from the simplicity of Monolithic architectures. But when growing or scaling, microservices can help significantly.&lt;/p&gt;

&lt;h3&gt;
  
  
  4) Version control everything
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzh6vv6b234qv51e1ds5q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzh6vv6b234qv51e1ds5q.png" alt="-" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DevOps Teams often apply version control to many different assets. From design and architectural assets, infrastructure, configuration, and of course - source code. Version control has a very useful property - it creates an immutable view of the history of changes. This enables a team to refer to exact changes made, as well as to roll back easily.&lt;/p&gt;

&lt;h3&gt;
  
  
  5) Automate everything
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fixgzu961qi2ra6y6r7nw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fixgzu961qi2ra6y6r7nw.png" alt="-" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By leveraging tools and technologies, DevOps fosters a culture of automation. Tasks that are repeated often, are manual, or are toilsome are usually primary targets of automation. Why automate? It lowers costs, significantly improves speed and throughput, reduces bugs + human error, and lets team members focus on high-value tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  DevOps Technologies
&lt;/h2&gt;

&lt;p&gt;By incorporating DevOps practices, a set of tools and technologies emerged.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcqogyskunh0v5pavevfp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcqogyskunh0v5pavevfp.png" alt="-" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The following are the core segments of DevOps Technologies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Scripting languages (eg. Python, Shell Script, Ruby)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Version control system (eg. Git, SVN)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;OS &amp;amp; Linux basics (terminal usage, mgmt. of processes, memory, storage, etc.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Networking &amp;amp; Security basics (IP, Firewalls, DNS, HTTPS, LBs, etc.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Containerization (eg. Docker, Kubernetes, etc.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;(CI/CD) Continuous Integration / Continuous Delivery (eg. Jenkins, Gitlab-ci, etc.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cloud Computing (eg. AWS, Azure, GCP, etc.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;(IaC) Infrastructure as Code (eg. Ansible, Terraform, etc.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Monitoring &amp;amp; Observability (eg. Elastic Stack, Prometheus, Grafana, etc.)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NOTE: this is neither a fixed nor a comprehensive list. As DevOps practices evolve, so will the technologies associated with them.&lt;/p&gt;

&lt;p&gt;Now, learning all these technologies might seem daunting.&lt;/p&gt;

&lt;p&gt;Or exciting.&lt;/p&gt;

&lt;p&gt;Or both.&lt;/p&gt;

&lt;p&gt;Whatever your response is, you might naturally ask…&lt;/p&gt;

&lt;h2&gt;
  
  
  Why learn DevOps?
&lt;/h2&gt;

&lt;p&gt;Below are the top 3 reasons we love DevOps!&lt;/p&gt;

&lt;h3&gt;
  
  
  1) Massive learning opportunity
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7ey3a7m6ss1okizxphez.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7ey3a7m6ss1okizxphez.png" alt="-" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;DevOps touches a lot of roles and domains, not just Dev and Ops. This means a DevOps Engineer has to learn continuously, enabling the opportunity to build a diverse skill set.&lt;/p&gt;

&lt;p&gt;Depending on the company, this can include elements of Design, Development, Operations, Testing, Management, etc.&lt;/p&gt;

&lt;p&gt;It sounds fantastic if you love to learn, but scary if you’re not into learning.&lt;/p&gt;

&lt;p&gt;In the coming days of Automation &amp;amp; AI, if you don’t develop a love for learning, you might be in trouble.&lt;/p&gt;

&lt;p&gt;Remember, learning is investing in yourself.&lt;/p&gt;

&lt;p&gt;As Warren Buffet puts it -&lt;/p&gt;

&lt;p&gt;“The best investment you can make is in yourself… The more you learn, the more you’ll earn.”&lt;/p&gt;

&lt;h3&gt;
  
  
  2) High-impact role
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8788g1jg3t14kkf2iev1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8788g1jg3t14kkf2iev1.png" alt="-" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a DevOps Engineer, you can move (technological) mountains.&lt;/p&gt;

&lt;p&gt;Is this a joke?&lt;/p&gt;

&lt;p&gt;Nope.&lt;/p&gt;

&lt;p&gt;Imagine commanding hundreds of servers at your will, automating manual-repetitive tasks, designing microservices, and having ownership of the entire SDLC.&lt;/p&gt;

&lt;p&gt;Your actions will have a direct impact on the business, including how quickly the product can be released, how smoothly your team members can work, etc.&lt;/p&gt;

&lt;p&gt;In other words, you will have a highly leveraged role.&lt;/p&gt;

&lt;p&gt;Sounds exciting, right?!&lt;/p&gt;

&lt;p&gt;Remember, with great power, comes great responsibility.&lt;/p&gt;

&lt;p&gt;And big money too! 💸&lt;/p&gt;

&lt;h3&gt;
  
  
  3) High salary &amp;amp; exploding demand
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgvmtiqlugi4fw85xttep.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgvmtiqlugi4fw85xttep.png" alt="-" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Companies realize the huge benefits of implementing DevOps. That’s why they are willing to pay top dollar for DevOps Engineers.&lt;/p&gt;

&lt;p&gt;For example, an average AWS Solutions Architect makes over $150k/year in the US, according to Glassdoor.&lt;/p&gt;

&lt;p&gt;What’s more, the demand is exploding!&lt;/p&gt;

&lt;p&gt;In 2021, Bain &amp;amp; Company reported a growth of 443% increase in DevOps job postings from 2015 to 2019. This growth is even higher than postings for Machine Learning (417%), Data Science (167%), or Software Engineering (69%).&lt;/p&gt;

&lt;p&gt;Additionally, most Engineers are not competent in DevOps, resulting in low supply and low competition.&lt;/p&gt;

&lt;p&gt;This is YOUR opportunity!&lt;/p&gt;

&lt;p&gt;You won’t have a hard time finding jobs with DevOps skills.&lt;/p&gt;

&lt;p&gt;You want to tap into this huge salary growth. But you think to yourself…&lt;/p&gt;

&lt;h2&gt;
  
  
  Do I HAVE to be a ‘DevOps Engineer’?
&lt;/h2&gt;

&lt;p&gt;Absolutely not.&lt;/p&gt;

&lt;p&gt;Any IT Professional can start learning DevOps, make an impact, and position themselves to be able to earn more.&lt;/p&gt;

&lt;p&gt;The shortage of DevOps Engineers means many companies don’t even have a dedicated role for “DevOps”. Instead, existing Software Engineers or System Administrators are usually trained in DevOps skills.&lt;/p&gt;

&lt;p&gt;But, most Engineers don’t become competent in DevOps due to…&lt;/p&gt;

&lt;h2&gt;
  
  
  The Challenges in learning DevOps
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8innu28w86bosbftlzj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8innu28w86bosbftlzj.png" alt="-" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Learning DevOps is often overwhelming, whether you’re about to start or already a practitioner.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;DevOps is complex: There are a lot of things to learn. Additionally, it is continuously evolving as new technologies come out every day.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lack of guidance: Due to the complexity and unique backgrounds of individuals, it is difficult to figure out an effective path to DevOps mastery.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Most resources are just theory: Tired of theory lectures and PowerPoint slides that offer no practical value? We are too.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Live classrooms don’t take your pace into account: Ever been stuck in a class that goes too fast or too slow? This often happens for live DevOps training because not everyone learns at the same pace.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How do you master DevOps effectively then?&lt;/p&gt;

&lt;h2&gt;
  
  
  How TechMormo helps you master DevOps?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvamc0700v8cvmzfvn23b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvamc0700v8cvmzfvn23b.png" alt="-" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At TechMormo, our goal is to help you master DevOps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Simplicity: we are obsessed with simplifying complex topics to help you become a better DevOps Engineer. We craft lectures with easy-to-understand animations and visuals.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Do projects, start to finish: Learn how to create and scale projects from start to finish, step-by-step. Whether you're just starting out or are already a practitioner, you will find value in our content.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Hands-on practical skills: Don’t just digest Theory. Learn hands-on practical skills that you can implement in your job TODAY.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Learn at your own pace: Stuck in a class that’s too slow or too fast? We create on-demand learning resources that you can use anytime, anywhere.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, what are you waiting for?&lt;/p&gt;

&lt;p&gt;Subscribe to the &lt;a href="https://techmormo.com/newsletter/" rel="noopener noreferrer"&gt;TechMormo Newsletter&lt;/a&gt; to get notified of new cutting-edge DevOps content.&lt;/p&gt;

&lt;p&gt;Learn DevOps, stand apart, and reap the rewards! 🏆&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we learnt what DevOps is including its core practices and technologies.&lt;/p&gt;

&lt;p&gt;We also discussed why learning DevOps is beneficial, what the challenges are in learning, and how TechMormo can help in your DevOps journey.&lt;/p&gt;

&lt;p&gt;DevOps is continuously evolving. The practices and technologies are likely to change over time. But what’s important is to understand its core purpose: “deliver better software faster”.&lt;/p&gt;

&lt;p&gt;Thanks for making it so far!&lt;/p&gt;

&lt;p&gt;We have a LOT more exciting DevOps content on the way! 🙌&lt;/p&gt;

&lt;p&gt;See you at the next one.&lt;/p&gt;

&lt;p&gt;Till then…&lt;/p&gt;

&lt;p&gt;Be bold and keep learning.&lt;/p&gt;

&lt;p&gt;But most importantly,&lt;/p&gt;

&lt;p&gt;Tech care!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>serverless</category>
      <category>automation</category>
      <category>productivity</category>
    </item>
    <item>
      <title>ভার্চুয়ালাইজেশন কি? (Virtualization) | ডকার কন্টেইনার vs ভার্চুয়াল মেশিন</title>
      <dc:creator>Farhim Ferdous</dc:creator>
      <pubDate>Tue, 24 Jan 2023 13:28:26 +0000</pubDate>
      <link>https://dev.to/alubhorta/bhaarcuyaalaaijeshn-ki-virtualization-ddkaar-kntteinaar-vs-bhaarcuyaal-meshin-3ma0</link>
      <guid>https://dev.to/alubhorta/bhaarcuyaalaaijeshn-ki-virtualization-ddkaar-kntteinaar-vs-bhaarcuyaal-meshin-3ma0</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;ভার্চুয়ালাইজেশনের সহজ বর্ণনা । কন্টেইনার এবং ভার্চুয়াল মেশিন (VM) এর মধ্যে তুলনা&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Originally published &lt;a href="https://techmormo.com/posts/bangla-what-is-virtualization/"&gt;here&lt;/a&gt;.&lt;br&gt;
Link to video: &lt;a href="https://youtu.be/K2pBaJeFD7E"&gt;https://youtu.be/K2pBaJeFD7E&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;ক্লাউড কম্পিউটিং! ডকার! কুবারনেটস! Serverless!…&lt;/p&gt;

&lt;p&gt;একজন সফটওয়্যার ইঞ্জিনিয়ার হিসাবে এই সকল শব্দ যদি আপনি না শুনে থাকেন তাহলে আপনি সম্ভবত কোন পাথরের নিচে বসবাস করছেন।&lt;/p&gt;

&lt;p&gt;কিন্তু এই সব প্রযুক্তির মধ্যে কোন জিনিসটা কমন আছে?&lt;/p&gt;

&lt;p&gt;ভার্চুয়ালাইজেশন!!!&lt;/p&gt;

&lt;p&gt;কিন্তু সেটা আসলে কি? এবং এটার সাথে ডকার কন্টেইনার বা ভার্চুয়াল মেশিন এর কি সম্পর্ক?&lt;/p&gt;

&lt;p&gt;এই টিউটোরিয়ালটিতে যতটা সম্ভব সহজভাবে আমরা এগুলো বোঝার চেষ্টা করবো।&lt;/p&gt;

&lt;p&gt;আমরা একটা উদাহরণ দিয়ে এটা বোঝার চেষ্টা করি।&lt;/p&gt;

&lt;h2&gt;
  
  
  উদাহরণ - কি সমস্যার সমাধান দরকার?
&lt;/h2&gt;

&lt;p&gt;ধরুন একটি কাল্পনিক কোম্পানি 'XYZ' এর দুটো সফটওয়্যার অ্যাপ্লিকেশান চালাতে হবে: App A ও App B। এখন কোন কারনে একটা অ্যাপ অন্যটার সাথে মানানসই (compatible) নয়।&lt;/p&gt;

&lt;p&gt;ধরেন অ্যাপ এ হচ্ছে একটা পাইথন অ্যাপ যেটা লিনাক্সে চালাতে হবে। এবং অন্যটা হচ্ছে একটা C# Dot Net অ্যাপ যেটা Windows এ চালাতে হবে।&lt;/p&gt;

&lt;p&gt;দুটো অ্যাপের অপারেটিং সিস্টেম এবং লাইব্রেরি dependency গুলো আলাদা।&lt;/p&gt;

&lt;p&gt;এখন কোম্পানি 'XYZ' কি কড়তে পারে?&lt;/p&gt;

&lt;p&gt;যদি ভার্চুয়ালাইজেশন বলতে কিছু না থাকে, তখন স্বাভাবিকভাবে কোম্পানি 'XYZ' দুটো কম্পিউটার কিনে আনবে। তারপর দুটো অ্যাপ দুই কম্পিউটার এ সেটআপ করে চালাবে।&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4dEO_vAf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pel49ad9fvdm8to1ki0x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4dEO_vAf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pel49ad9fvdm8to1ki0x.png" alt="img 1" width="532" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;চালানর পর হইলো কাহিনী।&lt;/p&gt;

&lt;p&gt;লক্ষ্য করুন যে, অ্যাপ A ব্যবহার করছে প্রথম মেশিনের ৩০%, আর অ্যাপ B দ্বিতীয় মেশিনের ৪০%।&lt;/p&gt;

&lt;p&gt;আমরা খুব সহজেই এই পদ্ধতির অসুবিধা দেখতে পাই:&lt;/p&gt;

&lt;p&gt;প্রতিটি অ্যাপই তার কম্পিউটার পুরোপুরি ব্যবহার করছে না - resource অপচয় &lt;/p&gt;

&lt;p&gt;অ্যাপ এর resource (CPU/Ram, etc) কত লাগবে তা অনুমান করা কঠিন - হয় বেশি বা কম অনুমান করা হবে &lt;/p&gt;

&lt;p&gt;প্রতিটি নতুন অ্যাপ্লিকেশনের জন্য অতিরিক্ত হার্ডওয়্যার কিনতে হবে - ব্যয়বহুল&lt;/p&gt;

&lt;p&gt;নিরাপত্তা ও ম্যানেজমেন্ট প্রতিটি সিস্টেমের জন্য আলাদাভাবে কড়তে হবে - ম্যানেজ করার পেড়া&lt;/p&gt;

&lt;p&gt;এই সমস্যাগুলার যদি কোন সমাধান না থাকতো, তাহলে এগুলো খুব একটা বড় বিষয় মনে হত না।&lt;/p&gt;

&lt;p&gt;সৌভাগ্যবশত, আমাদের কাছে এই সমস্যাগুলার সমাধান আছে - এবং এটিকে বলা হয়...&lt;/p&gt;

&lt;p&gt;ভার্চুয়ালাইজেশন।&lt;/p&gt;

&lt;h2&gt;
  
  
  ভার্চুয়ালাইজেশন এর সংজ্ঞা (Definition)
&lt;/h2&gt;

&lt;p&gt;ভার্চুয়ালাইজেশন হল সেই প্রযুক্তি যা দিয়ে আমরা একটা physical resource কে ভাগ করে একাধিক virtual resource এ পরিণত করতে পারি।&lt;/p&gt;

&lt;p&gt;যেমন, আমরা একটা কম্পিউটারের হার্ডওয়্যার অংশগুলো - যেমন CPU, RAM, Storage, ইত্যাদি এগুলো ভাগ করে অনেকগুলো ভার্চুয়াল ছোট কম্পিউটার বানাতে পারি।&lt;/p&gt;

&lt;p&gt;এটা কি কোন গাজাখরি গল্প বললাম?&lt;/p&gt;

&lt;p&gt;মোটেও না।&lt;/p&gt;

&lt;p&gt;আপনি যদি ভার্চুয়াল মেশিন বা ডকার কন্টেইনার ব্যবহার করে থাকেন, তাহলে এটার ব্যাপারে আপনার ইতিমধ্যে কিছুটা জানার কথা।&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GDuGkWFT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wsg5eudk4g42u6k1b3ct.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GDuGkWFT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wsg5eudk4g42u6k1b3ct.png" alt="img 2" width="252" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ভার্চুয়ালাইজেশনের সাহায্যে, একটি ফিজিক্যাল মেশিনকে কয়েকটি ছোট ভাগে ভাগ করা যায়। প্রত্যেকটি ছোট ভাগ নিজেকে মনে করে সে একজন রিয়েল ফিজিক্যাল মেশিন। কিন্তু সে আসলে জানেনা সে স্বপ্নের ভিতরে - তাই তাকে "ভার্চুয়াল" বলা হয়।&lt;/p&gt;

&lt;p&gt;ভার্চুয়াল এনভায়রনমেন্টের ভেতরে যেই অ্যাপগুল চলবে, সেই অ্যাপগুলোর শুধু তার ভার্চুয়াল এনভায়রনমেন্টের নির্ধারিত resource এর অ্যাক্সেস থাকবে।&lt;/p&gt;

&lt;p&gt;যদি অ্যাপ A ও অ্যাপ B চালানর পর মেশিনর আরো অতিরিক্ত resource থাকে, তাহলে কোম্পানি XYZ চাইলে আরো একটা অ্যাপ হয়তো চালাতে পারে। (যদিও দীর্ঘ সময়ের জন্য কোন কম্পিউটার ফুল লোডে ব্যবহার করা বুদ্ধিমানের কাজ হবে না)&lt;/p&gt;

&lt;p&gt;ভার্চুয়ালাইজেশন থাকায় কি লাভ হোল?&lt;/p&gt;

&lt;h3&gt;
  
  
  ভার্চুয়ালাইজেশন এর উপকারিতা (Benefits)
&lt;/h3&gt;

&lt;p&gt;হার্ডওয়্যারের খরচ সঞ্চয়: একটা মেশিনর physical resource গুলো (CPU, RAM, etc.) আরো দক্ষতার সাথে ব্যবহার করে আমরা হার্ডওয়্যার খরচ কমাতে পেরেছি। এতেকরে একটি মেশিনে একাধিক প্রোজেক্ট বা এনভায়রনমেন্ট চালানো যাবে।&lt;/p&gt;

&lt;p&gt;অ্যাপ্লিকেশন বিচ্ছিন্নতা (isolation): যেহেতু প্রতিটি ভার্চুয়াল এনভায়রনমেন্ট একটি ছোট 'রিয়েল' মেশিনের মত ভান করে, এতেকরে এক ভার্চুয়াল এনভায়রনমেন্টের অ্যাপগুলো অন্য ভার্চুয়াল এনভায়রনমেন্টের অ্যাপের কোন প্রবাভ ফেলে না। তাই, আমরা সহজেই প্রতিটি অ্যাপ আলাদাভাবে develop ও deploy কড়তে পারি।&lt;/p&gt;

&lt;p&gt;আর ভালো scalability ও availability: নতুন হার্ডওয়্যার কেনার থেকে ভার্চুয়াল এনভায়রনমেন্ট তৈরি করা বা রিমুভ করা আরো সহজ এবং দ্রুত। ভার্চুয়ালাইজেশনের মাধ্যমে আমাদের অ্যাপগুলো আমরা আরো সহজে scale কড়তে পারব - অর্থাৎ, নতুন মেশিন এড বা রিমুভ করা। আর, অ্যাপের একাধিক কপি চালিয়ে আমরা availability বৃদ্ধি কড়তে পারবো - অর্থাৎ, অ্যাপটা যে চলছে সেটার সম্ভাবনা বাড়াতে পারবো।&lt;/p&gt;

&lt;p&gt;আরও সহজ ম্যানেজমেন্ট ও নিরাপত্তা: যেহেতু অ্যাপ্লিকেশনগুলো তাদের ব্যবহার করা ফিসিকাল মেশিনগুলোর থেকে বিচ্ছিন্ন (ভার্চুয়ালাইজেশনের দ্বারা), তাই ফিসিকাল মেশিনগুলোকে কেন্দ্রীয়ভাবে পরিচালিত করা যেতে পারে এবং নিরাপত্তা নীতিগুলি (security policies) কেন্দ্রীয়ভাবে প্রয়োগ করা যেতে পারে। একশটা মেশিনে ঢুকে প্রত্যেকটা আপডেট করা, নাকি এক জায়গা থেকে একশোটা মেশিন আপডেট করা - কোনটা বেছে নিবেন?&lt;/p&gt;

&lt;h3&gt;
  
  
  ভার্চুয়ালাইজেশনের প্রকারভেদ (Types)
&lt;/h3&gt;

&lt;p&gt;ভার্চুয়ালাইজেশনের বিভিন্ন প্রকার রয়েছে, যেমন:&lt;/p&gt;

&lt;p&gt;হার্ডওয়্যার (Hardware) ভার্চুয়ালাইজেশন - ভিএম (VM)&lt;/p&gt;

&lt;p&gt;অপারেটিং সিস্টেম (OS) ভার্চুয়ালাইজেশন - কন্টেইনার (Containers)&lt;/p&gt;

&lt;p&gt;নেটওয়ার্ক (Network) ভার্চুয়ালাইজেশন&lt;/p&gt;

&lt;p&gt;ডেটা (Data) ভার্চুয়ালাইজেশন&lt;/p&gt;

&lt;p&gt;ইত্যাদি।&lt;/p&gt;

&lt;p&gt;কিন্তু আমরা শুধুমাত্র প্রথম দুইটিতে ফোকাস করবো এখন।&lt;/p&gt;

&lt;h2&gt;
  
  
  তুলনা: কন্টেইনার, ভার্চুয়াল মেশিন ও বেয়ার মেটাল
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_sNtfNJB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fcd1vxo9btbt3hx54nc1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_sNtfNJB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fcd1vxo9btbt3hx54nc1.png" alt="img 3" width="880" height="506"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  বেয়ার মেটাল (Bare metal)
&lt;/h3&gt;

&lt;p&gt;এটি প্রথম পদ্ধতি যা কোম্পানি XYZ নিয়েছে।&lt;/p&gt;

&lt;p&gt;কম্পিউটার আসার পর প্রথম প্রথম একটি অ্যাপ্লিকেশন চালানোর উপায় ছিল সরাসরি ডেডিকেটেড হার্ডওয়্যারের উপর। অর্থাৎ - একটি মেশিন, একটি অপারেটিং সিস্টেম (OS), একটি অ্যাপ।&lt;/p&gt;

&lt;p&gt;বেয়ার-মেটালের সবচেয়ে বড় সুবিধা হল, হোস্ট, লাইব্রেরি এবং অ্যাপের মধ্যে ভার্চুয়ালাইজেশন লেয়ার না থাকায় এটি সেরা পারফরম্যান্স দেয়। যদিও ভার্চুয়ালাইজেশনের পেনাল্টি সাধারণত বেশিরভাগ ক্ষেত্রে খুব গুরুতর নয়।&lt;/p&gt;

&lt;p&gt;যখন কেউ কাজ করার জন্য একটি কোম্পানির আইটি স্ট্যাক বেছে নিতো, তখন তারা সাধারণত সেই কোম্পানির নির্দিষ্ট হার্ডওয়্যার, ওএস বা লাইসেন্স চুক্তিতে লক-ইন হয়ে জেত। এতে করে - একক মেশিনে একাধিক অ্যাপ্লিকেশন চালানো খুব কঠিন হত।&lt;/p&gt;

&lt;p&gt;ফলে, কম্পিউটারগুলোর resources অপচয় হতো, বিভিন্ন টিমের/অ্যাপের জন্য নতুন এনভায়রনমেন্ট সহজে বানানো জেত না, এবং scale করা কঠিন ছিল, কারণ প্রতিটা নতুন অ্যাপের জন্য নতুন মেশিন কেনাটা ব্যয়বহুল। &lt;/p&gt;

&lt;p&gt;সমাধান কি তাহলে?&lt;/p&gt;

&lt;h3&gt;
  
  
  ভার্চুয়াল মেশিন (VM)
&lt;/h3&gt;

&lt;p&gt;১৯৯০ এর দশকে ভার্চুয়াল মেশিনের ব্যবহার বৃদ্ধি পেয়ে ভার্চুয়ালাইজেশন ব্যাপক আকারে ছড়িয়ে পড়লো।&lt;/p&gt;

&lt;p&gt;ভার্চুয়াল মেশিন বানানোর মুল প্রযুক্তি হোল হাইপারভাইজার (hypervisor)।&lt;/p&gt;

&lt;p&gt;একটি হাইপারভাইজার হল এমন একটি সফ্টওয়্যার যা কম্পিউটার হার্ডওয়্যারের একটি নির্দিষ্ট অংশ বা সম্পূর্ণ কম্পিউটারকে অনুকরণ (emulation) করে। এতে করে ফিসিকাল কম্পিউটারটাকে ভাগ করে একাধিক ভার্চুয়াল কম্পিউটার বানানো জায় - যেগুলোকে ভার্চুয়াল মেশিন বলা হয়।&lt;/p&gt;

&lt;p&gt;যে কম্পিউটারটি হাইপারভাইজার চালায় তাকে হোস্ট (host) সিস্টেম বলা হয়, এবং হাইপারভাইজার দ্বারা তৈরি ও পরিচালিত ভিএমগুলিকে গেস্ট (guest) সিস্টেম বলা হয়।&lt;/p&gt;

&lt;p&gt;হাইপারভাইজাররা সরাসরি হার্ডওয়্যারের উপরে (টাইপ-1) অথবা একটি ওএসের উপরে (টাইপ-2) বসতে পারে।&lt;/p&gt;

&lt;p&gt;ভার্চুয়াল মেশিন দারুণ এক প্রযুক্তি, কারণ তা দিয়ে আমরা বেয়ার মেটালের অনেক সমস্যার সমাধান করেছি।&lt;/p&gt;

&lt;p&gt;কিন্তু ভার্চুয়াল মেশিনেরও কিছু ত্রুটি রয়েছে। &lt;/p&gt;

&lt;p&gt;যেমন, প্রতিটি ভিএম একটি সম্পূর্ণ অপারেটিং সিস্টেম এবং এর প্রয়োজনীয় হার্ডওয়্যার ভার্চুয়ালাইজ করে। এটা কিছু ক্ষেত্রে আসলেই কার্যকর, যেমন জখন আমরা সুরক্ষার জন্য উচ্চ বিচ্ছিন্নতা (isloation) চাই। &lt;/p&gt;

&lt;p&gt;তবে অনেক ক্ষেত্রেই তা অপ্রয়োজনীয়।&lt;/p&gt;

&lt;p&gt;ভিএম থেকে হালকা কোন ভার্চুয়ালাইজেশন আছে কি?&lt;/p&gt;

&lt;h3&gt;
  
  
  কন্টেইনার (Container)
&lt;/h3&gt;

&lt;p&gt;কনটেইনারগুলি VM-এর মতো সম্পূর্ণ ফিজিক্যাল মেশিনকে ভার্চুয়ালাইজ না করে শুধুমাত্র অপারেটিং সিস্টেমকে ভার্চুয়ালাইজ করে।&lt;/p&gt;

&lt;p&gt;তাদের একটি গেস্ট ওএস এবং হাইপারভাইজারের প্রয়োজন নেই। &lt;/p&gt;

&lt;p&gt;পরিবর্তে, একটি হোস্ট মেশিনে চলমান সমস্ত কন্টেইনার হোস্ট সিস্টেমের ওএস কার্নেল (OS Kernel) ভাগ করে। শুধুমাত্র অ্যাপ্লিকেশন কোড, তাদের লাইব্রেরি এবং dependency গুলো কন্টেইনার ধারণ করে।&lt;/p&gt;

&lt;p&gt;তাই কন্টেইনার অত্যন্ত হালকা। এবং ভিএম বানানোর থেকে কন্টেইনার বানানো অনেক দ্রুত!&lt;/p&gt;

&lt;p&gt;এছাড়াও, কন্টেইনার ভিএম থেকে বেশি portable. জেহুতু কন্টেইনার ফিজিক্যাল মেশিনের হার্ডওয়্যার ভার্চুয়ালাইজ করেনা, সেজন্যে কন্টেইনারগুলোকে বিভিন্ন cloud প্লাটফর্ম বা ডেটা সেন্টেরে সহজে চালানো সম্ভব।&lt;/p&gt;

&lt;p&gt;এই কারণে কন্টেইনার দ্বারা অনেক DevOps সল্যুশন এবং বিষয় বৃদ্ধি পেয়েছে - যেমন মাইক্রোসার্ভিসেস, CI/CD পাইপলাইন, horizontal scaling, ইত্যাদি।&lt;/p&gt;

&lt;p&gt;কিন্তু কন্টেইনারই সব সমস্যার সমাধান নয়।&lt;/p&gt;

&lt;p&gt;যেহেতু অনেক কন্টেইনার একই হোস্ট মেশিনে চলে এবং হার্ডওয়্যার ভার্চুয়ালাইজ করে না, তাই তারা VM-এর তুলনায় কম বিচ্ছিন্নতা (isolation) প্রদান করে। &lt;/p&gt;

&lt;p&gt;এটি কিছু নিরাপত্তা বা সম্মতি (compliance) সংক্রান্ত সমস্যার জন্ম দিতে পারে, যা কিছু কিছু প্রকল্পে/প্রোজেক্টে একটি গুরুত্বপূর্ণ বিবেচনা হতে পারে।&lt;/p&gt;

&lt;p&gt;কিন্তু এটি বেশিরভাগ অ্যাপ্লিকেশনের জন্য চিন্তার বিষয় নয়। So relax!&lt;/p&gt;

&lt;h2&gt;
  
  
  উপসংহার (Conclusion)
&lt;/h2&gt;

&lt;p&gt;বেয়ার মেটালের পেড়া থেকে আমরা ভার্চুয়ালাইজেশনের বিপ্লব পেয়েছি।&lt;/p&gt;

&lt;p&gt;আজকের বেশিরভাগ অ্যাপ্লিকেশনগুলি ভার্চুয়ালাইজেশনের দ্বারা চলে। এমনকি ক্লাউড কম্পিউটিং ও এটার দ্বারা বাস্তবায়ন করা।&lt;/p&gt;

&lt;p&gt;OS ভার্চুয়ালাইজেশনের ধারণাটি প্রায় ২০০০ দশকের প্রথম থেকেই প্রচারিত। কিন্তু আধুনিক কন্টেইনার যুগ ২০১৩ সাল থেকে শুরু হয়, ডকারের হাত ধরে।&lt;/p&gt;

&lt;p&gt;TechMormo তে আমাদের ডকার কন্টেইনার খুব প্রিয়! আমাদের ইতিমধ্যে ডকার নিয়ে বেশ কিছু ইংলিশ ব্লগ ও ভিডিও বানানো হয়েছে।&lt;/p&gt;

&lt;p&gt;Docker Made Easy &lt;/p&gt;

&lt;p&gt;Networking in Docker&lt;/p&gt;

&lt;p&gt;Blogs on Docker&lt;/p&gt;

&lt;p&gt;আপনি কি বাংলাতে ডকার শিখতে চান? নাকি অন্য কোন DevOps বিষয় শিখতে চান?&lt;/p&gt;

&lt;p&gt;কমেন্ট করে বা Feedback পেইজ এ আমাদের জানবেন প্লিস।&lt;/p&gt;

&lt;p&gt;আজ এই পর্যন্তই।&lt;/p&gt;

&lt;p&gt;Be bold and keep learning.&lt;/p&gt;

&lt;p&gt;But most importantly,&lt;/p&gt;

&lt;p&gt;Tech care!&lt;/p&gt;




&lt;p&gt;Subscribe to &lt;a href="https://techmormo.com/newsletter/"&gt;TechMormo Newsletter&lt;/a&gt; for cutting-edge DevOps content! 🚀&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cloud</category>
      <category>virtualization</category>
      <category>docker</category>
    </item>
    <item>
      <title>What is Docker Compose? (with demo)</title>
      <dc:creator>Farhim Ferdous</dc:creator>
      <pubDate>Sun, 30 Oct 2022 20:11:34 +0000</pubDate>
      <link>https://dev.to/alubhorta/what-is-docker-compose-with-demo-bfp</link>
      <guid>https://dev.to/alubhorta/what-is-docker-compose-with-demo-bfp</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Learn what Docker Compose is, how it makes the life of an Engineer easier and possible use cases&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Link to video: &lt;a href="https://youtu.be/yFvO8Atszl8" rel="noopener noreferrer"&gt;https://youtu.be/yFvO8Atszl8&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;What the heck is Docker Compose and how does it make the life of an Engineer like you easier?&lt;/p&gt;

&lt;p&gt;This tutorial will answer that (and more), as simply as possible.&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;Agenda for this tutorial:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is Docker Compose?&lt;/li&gt;
&lt;li&gt;Why it exists? How does it differ from &lt;code&gt;docker run&lt;/code&gt;?&lt;/li&gt;
&lt;li&gt;How to use Docker Compose?&lt;/li&gt;
&lt;li&gt;When to use it? - use cases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Absolutely new to Docker? Check out: &lt;a href="https://techmormo.com/posts/docker-made-easy-1-what-is-docker/" rel="noopener noreferrer"&gt;What is Docker?&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want to learn more about Docker Networking? Check out: &lt;a href="https://techmormo.com/posts/docker-networking-8-summary/" rel="noopener noreferrer"&gt;Docker Networking Summary&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Alright…&lt;/p&gt;

&lt;h1&gt;
  
  
  What is Docker Compose?
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Docker Compose is a tool for defining and running multi-container applications.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With Compose, you use a YAML file to configure your application’s services (containers). Then, with a single command, you can build, start or delete your application services.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxi2c3o2okxgwp0majkkz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxi2c3o2okxgwp0majkkz.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Why Docker Compose exists? How does it differ from &lt;code&gt;docker run&lt;/code&gt;?
&lt;/h1&gt;

&lt;p&gt;Running multiple containers is a very common scenario.&lt;/p&gt;

&lt;p&gt;Take for example a WordPress (WP) application. It consists of a WordPress service that talks to a MySQL database.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsaxkx50lyezl9ubyucej.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsaxkx50lyezl9ubyucej.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We could run both containers using two &lt;code&gt;docker run&lt;/code&gt; commands with a bunch of cli arguments. The &lt;code&gt;db&lt;/code&gt; container might be started like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--name&lt;/span&gt; db &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--restart&lt;/span&gt; always &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-v&lt;/span&gt; db_data:/var/lib/mysql &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;MYSQL_ROOT_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;supersecret &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;MYSQL_DATABASE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;exampledb &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;MYSQL_USER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;exampleuser &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;MYSQL_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;examplepass &lt;span class="se"&gt;\&lt;/span&gt;
  mysql:5.7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Additionally, we might need to isolate these containers from the host or other containerized applications. We could create or remove networks with &lt;code&gt;docker network&lt;/code&gt; commands, and modify &lt;code&gt;docker run&lt;/code&gt; to take the network as an argument.&lt;/p&gt;

&lt;p&gt;Typing out these verbose commands might be fine once or twice. But as the number of containers and configurations grows, they become increasingly harder to manage.&lt;/p&gt;

&lt;p&gt;With Compose, we simply define the application’s configuration on a YAML file (named &lt;code&gt;docker-compose.yml&lt;/code&gt; by default) like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;3.9'&lt;/span&gt;

&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;db&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mysql:5.7&lt;/span&gt;
    &lt;span class="na"&gt;restart&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;always&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;MYSQL_DATABASE&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;exampledb&lt;/span&gt;
      &lt;span class="na"&gt;MYSQL_USER&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;exampleuser&lt;/span&gt;
      &lt;span class="na"&gt;MYSQL_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;examplepass&lt;/span&gt;
      &lt;span class="na"&gt;MYSQL_ROOT_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;supersecret&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;db_data:/var/lib/mysql&lt;/span&gt;
  &lt;span class="na"&gt;wordpress&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;wordpress&lt;/span&gt;
    &lt;span class="na"&gt;restart&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;always&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;8080:80&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;WORDPRESS_DB_HOST&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;db&lt;/span&gt;
      &lt;span class="na"&gt;WORDPRESS_DB_USER&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;exampleuser&lt;/span&gt;
      &lt;span class="na"&gt;WORDPRESS_DB_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;examplepass&lt;/span&gt;
      &lt;span class="na"&gt;WORDPRESS_DB_NAME&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;exampledb&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;wordpress_data:/var/www/html&lt;/span&gt;

&lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;wordpress_data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;db_data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This file defines 2 services, &lt;code&gt;db&lt;/code&gt; and &lt;code&gt;wordpress&lt;/code&gt;. It also specifies the configuration options for each - like the image, environment variables, published ports, volumes, etc.&lt;/p&gt;

&lt;p&gt;NOTE: if you don’t understand all these options yet, that’s fine.&lt;/p&gt;

&lt;p&gt;After creating this file, we execute &lt;code&gt;docker compose up&lt;/code&gt;, and Docker builds and runs our entire application in a new isolated environment (&lt;a href="https://techmormo.com/posts/docker-networking-6-bridge-driver/" rel="noopener noreferrer"&gt;bridge network&lt;/a&gt; by default).&lt;/p&gt;

&lt;p&gt;Similarly, we can use the &lt;code&gt;docker compose down&lt;/code&gt; command to tear everything down (except volumes).&lt;/p&gt;

&lt;p&gt;Easy! Right? 👌&lt;/p&gt;

&lt;p&gt;This is how compose simplifies running multi-container applications on a single host.&lt;/p&gt;

&lt;p&gt;Being able to declare and reuse the configuration as a file makes the life of an Engineer much easier. It also allows us to version control, run tests and review our configuration just like the application’s source code.&lt;/p&gt;

&lt;p&gt;Besides the benefits above, Compose provides the following &lt;a href="https://docs.docker.com/compose/features-uses/#key-features-of-docker-compose" rel="noopener noreferrer"&gt;key features&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Have multiple isolated environments on a single host&lt;/li&gt;
&lt;li&gt;Preserve volume data when containers are created&lt;/li&gt;
&lt;li&gt;Only recreate containers that have changed&lt;/li&gt;
&lt;li&gt;Share variables or configurations between environments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s all good to know. But let’s learn…&lt;/p&gt;

&lt;h1&gt;
  
  
  How to use Docker Compose?
&lt;/h1&gt;

&lt;p&gt;Source code for this demo: &lt;a href="https://github.com/AluBhorta/docker-compose-demo" rel="noopener noreferrer"&gt;https://github.com/AluBhorta/docker-compose-demo&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: &lt;strong&gt;Install Docker &amp;amp; Docker Compose&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;First of all, make sure you have installed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/engine/install/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/compose/install/" rel="noopener noreferrer"&gt;Docker Compose&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NOTE: since Compose version 2, we use &lt;code&gt;docker compose&lt;/code&gt; command instead of &lt;code&gt;docker-compose&lt;/code&gt;. This tutorial uses version 2.&lt;/p&gt;




&lt;h3&gt;
  
  
  Step 2: &lt;strong&gt;Create a sample web application&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Open up a terminal, create a new directory and switch into it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;docker-compose-demo
&lt;span class="nb"&gt;cd &lt;/span&gt;docker-compose-demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the code for a simple Python web app on a file named &lt;code&gt;app.py&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;cache&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;redis&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;6379&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;incr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;hits&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Hello World! I have been seen {} times.&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a Flask app with a single HTTP endpoint (&lt;code&gt;/&lt;/code&gt;). This endpoint returns how many times it has been visited. The count is stored and incremented as an integer with a key named &lt;code&gt;hits&lt;/code&gt; in a Redis host named &lt;code&gt;redis&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Then we add the Python dependencies to a &lt;code&gt;requirements.txt&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flask
redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, we create a &lt;code&gt;Dockerfile&lt;/code&gt; - to create a Docker image based on this application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; python:3.7-alpine&lt;/span&gt;

&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /code&lt;/span&gt;

&lt;span class="k"&gt;RUN &lt;/span&gt;apk add &lt;span class="nt"&gt;--no-cache&lt;/span&gt; gcc musl-dev linux-headers

&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; requirements.txt requirements.txt&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt

&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 5000&lt;/span&gt;

&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;

&lt;span class="k"&gt;ENV&lt;/span&gt;&lt;span class="s"&gt; FLASK_APP=app.py&lt;/span&gt;
&lt;span class="k"&gt;ENV&lt;/span&gt;&lt;span class="s"&gt; FLASK_RUN_HOST=0.0.0.0&lt;/span&gt;

&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["flask", "run"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells Docker to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build an image starting with the Python 3.7 Alpine Linux image&lt;/li&gt;
&lt;li&gt;Set the working directory to &lt;code&gt;/code&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Install &lt;code&gt;gcc&lt;/code&gt; and other dependencies with the &lt;code&gt;apk&lt;/code&gt; package manager&lt;/li&gt;
&lt;li&gt;Copy &lt;code&gt;requirements.txt&lt;/code&gt; from host to image&lt;/li&gt;
&lt;li&gt;Install the Python dependencies with &lt;code&gt;pip&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add metadata to the image to describe that the container is listening on port 5000&lt;/li&gt;
&lt;li&gt;Copy the current directory &lt;code&gt;.&lt;/code&gt; in the project to the workdir &lt;code&gt;.&lt;/code&gt; in the image&lt;/li&gt;
&lt;li&gt;Set environment variables used by the &lt;code&gt;flask&lt;/code&gt; command&lt;/li&gt;
&lt;li&gt;Set the default command for the container to &lt;code&gt;flask run&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then we create a &lt;code&gt;docker-compose.yml&lt;/code&gt; file for us to use Docker Compose:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;3.9"&lt;/span&gt;

&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;redis&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;redis:alpine"&lt;/span&gt;
  &lt;span class="na"&gt;web&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;.&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;8000:5000"&lt;/span&gt;
    &lt;span class="na"&gt;depends_on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;redis&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This Compose file defines two services: &lt;code&gt;web&lt;/code&gt; and &lt;code&gt;redis&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;redis&lt;/code&gt; service uses a public &lt;code&gt;redis:alpine&lt;/code&gt; image pulled from the Docker Hub registry.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;web&lt;/code&gt; service uses an image that’s built from the &lt;code&gt;Dockerfile&lt;/code&gt; in the current directory (&lt;code&gt;.&lt;/code&gt;). It then maps port &lt;code&gt;8000&lt;/code&gt; on the host to port &lt;code&gt;5000&lt;/code&gt; on the container where the flask server will be running. It also specifies that &lt;code&gt;web&lt;/code&gt; depends on &lt;code&gt;redis&lt;/code&gt; so that Docker knows to start &lt;code&gt;redis&lt;/code&gt; before &lt;code&gt;web&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;NOTE: since Compose creates a new bridge network on project startup, &lt;code&gt;web&lt;/code&gt; can reach &lt;code&gt;redis&lt;/code&gt; simply by using the service’s name ie. &lt;code&gt;redis&lt;/code&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  Step 3: Run and test the application
&lt;/h3&gt;

&lt;p&gt;To run the application, all we have to do now is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose up
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Docker will automatically pull the &lt;code&gt;redis&lt;/code&gt; image, build our &lt;code&gt;web&lt;/code&gt; image and start the containers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5jdr7vnt055cnl5b4y03.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5jdr7vnt055cnl5b4y03.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once deployed, we should now be able to reach the application at &lt;a href="http://localhost:8000" rel="noopener noreferrer"&gt;localhost:8000&lt;/a&gt; on your browser. &lt;/p&gt;

&lt;p&gt;Or alternatively, use curl on a separate terminal to reach the flask application like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl localhost:8000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hello World! I have been seen 1 times.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The count is incremented every time we make a request. &lt;/p&gt;

&lt;p&gt;Awesome! 👌&lt;/p&gt;

&lt;p&gt;We can list the containers of the Compose project with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose ps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NOTE: &lt;code&gt;docker compose up&lt;/code&gt; will by default attach to your terminal and print the logs from the services. We can use &lt;code&gt;ctrl+c&lt;/code&gt; to detach that terminal, but it will stop the services.&lt;/p&gt;

&lt;p&gt;To run the services in the background, use &lt;code&gt;-d&lt;/code&gt; the flag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose up &lt;span class="nt"&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to view the logs, use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose logs &lt;span class="nt"&gt;-f&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NOTE: &lt;code&gt;-f&lt;/code&gt; will follow the log output as new logs are generated.&lt;/p&gt;




&lt;h3&gt;
  
  
  Step 4: Modify the application
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Changes are inevitable.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let us make a change to our app. &lt;/p&gt;

&lt;p&gt;The &lt;code&gt;web&lt;/code&gt; container is printing out a warning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In production, we definitely want to run a production-grade server like &lt;code&gt;gunicorn&lt;/code&gt; instead of the development server we get with &lt;code&gt;flask run&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So, let’s first add &lt;code&gt;gunicorn&lt;/code&gt; to &lt;code&gt;requirements.txt&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flask
redis
gunicorn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then remove the last 3 instructions of &lt;code&gt;Dockerfile&lt;/code&gt; and add a new &lt;code&gt;CMD&lt;/code&gt; instruction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; python:3.7-alpine&lt;/span&gt;

&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /code&lt;/span&gt;

&lt;span class="k"&gt;RUN &lt;/span&gt;apk add &lt;span class="nt"&gt;--no-cache&lt;/span&gt; gcc musl-dev linux-headers

&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; requirements.txt requirements.txt&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt

&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 5000&lt;/span&gt;

&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;

&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Images built from this &lt;code&gt;Dockerfile&lt;/code&gt; will now run &lt;code&gt;gunicorn&lt;/code&gt; instead of the flask dev server.&lt;/p&gt;

&lt;p&gt;Once we’ve made the changes, we need to rebuild the &lt;code&gt;web&lt;/code&gt; image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker compose build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we restart the &lt;code&gt;web&lt;/code&gt; service to use the new image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose up web &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--no-deps&lt;/span&gt; &lt;span class="nt"&gt;-t&lt;/span&gt; 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NOTE: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;--no-deps&lt;/code&gt; tells Docker not to (re)start dependent services.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-t 1&lt;/code&gt; specifies the container shutdown timeout of 1 second instead of the default 10s.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Try to reach &lt;code&gt;web&lt;/code&gt; again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl localhost:8000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It should work as expected.&lt;/p&gt;

&lt;p&gt;But if you check the logs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose logs web &lt;span class="nt"&gt;-f&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will notice we don’t have the warning anymore since we’re using gunicorn. &lt;/p&gt;

&lt;p&gt;Noice!&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Clean up
&lt;/h3&gt;

&lt;p&gt;To remove all the services, we simply run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose down
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we had defined volumes in the services (like in the WordPress example), the volumes wouldn’t be automatically removed with &lt;code&gt;docker compose down&lt;/code&gt;. This is mainly to avoid accidental deletion of data.&lt;/p&gt;

&lt;p&gt;To tear down everything including volumes, use the &lt;code&gt;-v&lt;/code&gt; flag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose down &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Congratulations! You can now Compose! 🙌&lt;/p&gt;




&lt;h1&gt;
  
  
  When to use Docker Compose? - use cases
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;*&lt;strong&gt;&lt;em&gt;Development environments&lt;/em&gt;&lt;/strong&gt;*&lt;/p&gt;

&lt;p&gt;When developing software, the ability to run applications and their dependencies in isolated environments is crucial. For example, you might have a dependency on another team’s application, which in turn might have its own set of complexities like configuring the database in a particular way. By using Compose, you can run the whole stack or remove it with a single command.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;*&lt;strong&gt;&lt;em&gt;Automated testing environments&lt;/em&gt;&lt;/strong&gt;*&lt;/p&gt;

&lt;p&gt;Automated workflows like CI/CD pipelines generally require tools to easily create and destroy environments. Containers are ideal for such environments due to their low resource footprint and speed. By using a configuration file, Compose provides a convenient way to create and destroy such environments for your test suite.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;*&lt;strong&gt;&lt;em&gt;Single host deployments&lt;/em&gt;&lt;/strong&gt;*&lt;/p&gt;

&lt;p&gt;Although Compose was mainly developed for development and testing workflows, it is sometimes used in production for running containers on a single host. While Compose is improving, it is not an orchestrator like Swarm or Kubernetes, but more of a wrapper around Docker’s API. Check out the &lt;a href="https://docs.docker.com/compose/production/" rel="noopener noreferrer"&gt;official documentation&lt;/a&gt; before using compose in production.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this tutorial, we learnt what Docker Compose is, why it exists, how to use it and when to use it.&lt;/p&gt;

&lt;p&gt;By specifying container configuration in a file, Compose simplifies running multi-container workloads on a single host.&lt;/p&gt;

&lt;p&gt;If you found this tutorial helpful, leaving a like, comment or subscribing will really help us out.&lt;/p&gt;

&lt;p&gt;You might also enjoy our &lt;a href="https://youtube.com/@techmormo" rel="noopener noreferrer"&gt;YouTube Channel&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thanks for making it so far!&lt;/p&gt;

&lt;p&gt;We have a LOT more exciting DevOps content on the way! 🙌&lt;/p&gt;

&lt;p&gt;See you at the next one.&lt;/p&gt;

&lt;p&gt;Till then…&lt;/p&gt;

&lt;p&gt;Be bold and keep learning.&lt;/p&gt;

&lt;p&gt;But most importantly,&lt;/p&gt;

&lt;p&gt;Tech care!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>containers</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Docker Networking Summary | Networking in Docker #8</title>
      <dc:creator>Farhim Ferdous</dc:creator>
      <pubDate>Mon, 24 Oct 2022 11:39:16 +0000</pubDate>
      <link>https://dev.to/alubhorta/docker-networking-summary-networking-in-docker-8-4gk</link>
      <guid>https://dev.to/alubhorta/docker-networking-summary-networking-in-docker-8-4gk</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Summary of Docker Networking Series&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Link to video: &lt;a href="https://www.youtube.com/watch?v=3c0miSU038E"&gt;https://www.youtube.com/watch?v=3c0miSU038E&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;How do Docker Containers communicate using networks?&lt;/p&gt;

&lt;p&gt;If you have gone through all the tutorials in this series, you should know that well by now.&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;This blog is the 8th and last tutorial in a series for Docker Networking.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-1-why-is-networking-important/"&gt;blog #1 - &lt;strong&gt;Why is Networking important in Docker?&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-2-basics-of-networking/"&gt;blog #2 - &lt;strong&gt;Basics of Networking&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://techmormo.com/posts/docker-networking-3-drivers-overview/"&gt;blog #3 - &lt;strong&gt;Docker Network Drivers Overview&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-4-none-driver/"&gt;blog #4 - &lt;strong&gt;None Network Driver&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://techmormo.com/posts/docker-networking-5-host-driver/"&gt;blog #5 - &lt;strong&gt;Host Network Driver&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://techmormo.com/posts/docker-networking-6-bridge-driver/"&gt;blog #6 - &lt;strong&gt;Bridge Network Driver&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://techmormo.com/posts/docker-networking-7-overlay-driver/"&gt;blog #7 - &lt;strong&gt;Overlay Network Driver&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are looking to learn more about the basics of Docker, I’ll recommend checking out the &lt;a href="https://www.techmormo.com/posts/docker-made-easy-1-what-is-docker/"&gt;Docker Made Easy&lt;/a&gt; series.&lt;/p&gt;

&lt;h1&gt;
  
  
  Summary
&lt;/h1&gt;

&lt;p&gt;In this series, first we answered “&lt;a href="https://www.techmormo.com/posts/docker-networking-1-why-is-networking-important/"&gt;Why is networking important in Docker?&lt;/a&gt;”.&lt;/p&gt;

&lt;p&gt;Then we learnt about some &lt;a href="https://www.techmormo.com/posts/docker-networking-2-basics-of-networking/"&gt;core networking concepts&lt;/a&gt; like the Internet Protocol (IP), network interfaces, subnets, network ports, DNS, etc.&lt;/p&gt;

&lt;p&gt;Then we discussed about &lt;a href="https://techmormo.com/posts/docker-networking-3-drivers-overview/"&gt;Docker Network Drivers&lt;/a&gt;, which is how Docker hides the network details and simplifies how to attach different types of networks to containers.&lt;/p&gt;

&lt;p&gt;We then dived into the of the 4 main Network Drivers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-4-none-driver/"&gt;none driver&lt;/a&gt; - isolates a container by disabling its network.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://techmormo.com/posts/docker-networking-5-host-driver/"&gt;host driver&lt;/a&gt; - allows the container to share the network stack of the host system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://techmormo.com/posts/docker-networking-6-bridge-driver/"&gt;bridge driver&lt;/a&gt; - creates an internal network within a single host.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://techmormo.com/posts/docker-networking-7-overlay-driver/"&gt;overlay driver&lt;/a&gt; - creates a distributed network able to span multiple hosts.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For each of the Network Drivers, we learnt how to use it, some possible use cases and their limitations.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion &amp;amp; what’s next?
&lt;/h1&gt;

&lt;p&gt;Thank you so much for making it so far! 🎉 🫂&lt;/p&gt;

&lt;p&gt;It has been a great pleasure and learning experience to share about Docker Networking with you. I myself got to learn many important concepts and details in the making of this series.&lt;/p&gt;

&lt;p&gt;What do you want to learn next?&lt;/p&gt;

&lt;p&gt;Want more Docker? What about Kubernetes, AWS, Linux, Git, Python, or something else entirely?&lt;/p&gt;

&lt;p&gt;We need &lt;a href="https://techmormo.com/feedback"&gt;YOUR FEEDBACK 🎯&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is just the start! We’re actively working to simplify complex DevOps + Engineering topics, and help you become a more competent Engineer.&lt;/p&gt;

&lt;p&gt;If you found any mistakes or have any suggestions to improve our content, please let us know.&lt;/p&gt;

&lt;p&gt;See you on the next one.&lt;/p&gt;

&lt;p&gt;Till then…&lt;/p&gt;

&lt;p&gt;Be bold and keep learning.&lt;/p&gt;

&lt;p&gt;But most importantly,&lt;/p&gt;

&lt;p&gt;Tech care!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>cloud</category>
      <category>networking</category>
    </item>
    <item>
      <title>The Overlay Network Driver | Networking in Docker #7</title>
      <dc:creator>Farhim Ferdous</dc:creator>
      <pubDate>Wed, 12 Oct 2022 13:21:48 +0000</pubDate>
      <link>https://dev.to/alubhorta/the-overlay-network-driver-networking-in-docker-7-1nfe</link>
      <guid>https://dev.to/alubhorta/the-overlay-network-driver-networking-in-docker-7-1nfe</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Learn how the Overlay driver simplifies multi-host networking on Docker, how to use it, possible use cases and limitations&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Link to video: &lt;a href="https://www.youtube.com/watch?v=gJVcKVdYhpI"&gt;https://www.youtube.com/watch?v=gJVcKVdYhpI&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;What is the &lt;code&gt;overlay&lt;/code&gt; network driver in Docker and how does it power docker swarm and multi-host container networking?&lt;/p&gt;

&lt;p&gt;This blog will try to answer that (and more) as simply as possible.&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;This blog is the seventh one in a series for Docker Networking.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-1-why-is-networking-important/"&gt;blog #1 - &lt;strong&gt;Why is Networking important in Docker?&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-2-basics-of-networking/"&gt;blog #2 - &lt;strong&gt;Basics of Networking&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://techmormo.com/posts/docker-networking-3-drivers-overview/"&gt;blog #3 - &lt;strong&gt;Docker Network Drivers Overview&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-4-none-driver/"&gt;blog #4 - &lt;strong&gt;None Network Driver&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://techmormo.com/posts/docker-networking-5-host-driver/"&gt;blog #5 - &lt;strong&gt;Host Network Driver&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://techmormo.com/posts/docker-networking-6-bridge-driver/"&gt;blog #6 - &lt;strong&gt;Bridge Network Driver&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are looking to learn more about the basics of Docker, I’ll recommend checking out the &lt;a href="https://www.techmormo.com/posts/docker-made-easy-1-what-is-docker/"&gt;Docker Made Easy&lt;/a&gt; series.&lt;/p&gt;

&lt;p&gt;Here’s the agenda for this blog:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is the &lt;code&gt;overlay&lt;/code&gt; network driver?&lt;/li&gt;
&lt;li&gt;How to use it?&lt;/li&gt;
&lt;li&gt;When to use it? - possible use cases&lt;/li&gt;
&lt;li&gt;What are its limitations?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here are some quick reminders:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;Docker host&lt;/strong&gt; is a physical or virtual machine that runs the Docker daemon.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Network drivers&lt;/strong&gt; enable us to easily use multiple types of networks for containers and hide the complexity required for network implementations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Alright, so...&lt;/p&gt;

&lt;h1&gt;
  
  
  What is the &lt;code&gt;overlay&lt;/code&gt; driver?
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;overlay&lt;/code&gt; network driver creates a distributed network that can span multiple docker hosts.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7U2e0okc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5rthf6rfqdx91e878kdi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7U2e0okc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5rthf6rfqdx91e878kdi.png" alt="overlay driver" width="880" height="531"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Overlay networks were designed to be used with &lt;em&gt;docker swarm services&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Docker swarm is a container orchestration tool (like Kubernetes) that allows us to manage multiple containers on multiple hosts.&lt;/p&gt;

&lt;p&gt;To deploy an application (ie. docker image) on the swarm, we create a swarm service, which can run 1 or more containers from the image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aCvayyuC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bigjubgbu0gurj0gc3lk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aCvayyuC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bigjubgbu0gurj0gc3lk.png" alt="swarm service example" width="880" height="590"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;They will make more sense when we actually try them out in a moment.&lt;/p&gt;

&lt;p&gt;When a docker host initiates or joins a swarm, 2 new networks are created:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a default &lt;code&gt;overlay&lt;/code&gt; network called &lt;code&gt;ingress&lt;/code&gt; which handles the control and data traffic related to swarm services.&lt;/li&gt;
&lt;li&gt;and a virtual &lt;code&gt;bridge&lt;/code&gt; network called &lt;code&gt;docker_gwbridge&lt;/code&gt; that connects overlay networks to the individual Docker daemon’s physical network.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Like custom bridge networks we saw in the last tutorial, custom or user-defined overlay networks can be created using the &lt;code&gt;docker network create&lt;/code&gt; command (using the &lt;code&gt;--driver overlay&lt;/code&gt; option).&lt;/p&gt;

&lt;p&gt;Let’s directly see overlay drivers in action…&lt;/p&gt;

&lt;h1&gt;
  
  
  How to use the &lt;code&gt;overlay&lt;/code&gt; driver?
&lt;/h1&gt;

&lt;p&gt;I encourage you to follow along to get the most out of this tutorial.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Initialize the swarm&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Provision hosts with network connectivity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To see the full potential of overlay networks, we need multiple hosts. Let’s go with 3.&lt;/p&gt;

&lt;p&gt;The simplest solution is to use a Virtual Machine tool like &lt;a href="https://www.virtualbox.org/"&gt;VirtualBox&lt;/a&gt; or &lt;a href="https://mac.getutm.app/"&gt;UTM&lt;/a&gt; (on Mac) to create multiple VMs.&lt;/p&gt;

&lt;p&gt;For multiple machines to communicate together as a swarm using overlay, docker requires the following ports to be open between the hosts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TCP port 2377 for cluster management communications&lt;/li&gt;
&lt;li&gt;TCP and UDP port 7946 for communication among nodes&lt;/li&gt;
&lt;li&gt;UDP port 4789 for overlay network traffic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re running VMs locally, make sure the VMs can reach each other over the network (ie. select ”Internal Network” on VirtualBox, or “Shared Network” on UTM).&lt;/p&gt;

&lt;p&gt;If you’re running VMs on the cloud or in a strict networked environment, make sure to update your firewall rules / security groups to account for the open port requirements.&lt;/p&gt;

&lt;p&gt;Before moving forward, ensure connectivity between your hosts with something like &lt;code&gt;ping&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I have created 3 Debain Linux VMs named node1, node2 and node3.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install Docker&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Follow the official docker instructions to install Docker Server on all your hosts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.docker.com/engine/install/"&gt;https://docs.docker.com/engine/install/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create the swarm and join the nodes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the first node, we will run the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker swarm init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will initialize the swarm with the first node as the manager and the only member for now.&lt;/p&gt;

&lt;p&gt;It should also print the command that will let us add other nodes into the swarm as workers, like the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker swarm &lt;span class="nb"&gt;join&lt;/span&gt; &lt;span class="nt"&gt;--token&lt;/span&gt; SWMTKN-1-07ti6ugkt6hia44ljws48eik9t4v0806515jkodf3zn1pb7uod-15c75qxan0guvqmcswt4blz2l 192.168.64.4:2377
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will copy the full &lt;code&gt;docker swarm join&lt;/code&gt; command and run it on each of our remaining nodes.&lt;/p&gt;

&lt;p&gt;When all are successfully joined, we can check the nodes by running the following on the manager node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker node &lt;span class="nb"&gt;ls&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can also check that the 2 new networks were created with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker network &lt;span class="nb"&gt;ls&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Awesome, we now have a docker swarm cluster with an overlay network!&lt;/p&gt;

&lt;h3&gt;
  
  
  The default overlay network - &lt;code&gt;ingress&lt;/code&gt; and routing mesh
&lt;/h3&gt;

&lt;p&gt;Let us start off by creating a service named &lt;code&gt;whoami&lt;/code&gt; using the &lt;code&gt;containous/whoami&lt;/code&gt; image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker service create &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--name&lt;/span&gt; &lt;span class="nb"&gt;whoami&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-p&lt;/span&gt; 8000:80 &lt;span class="se"&gt;\&lt;/span&gt;
    containous/whoami
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This image runs a tiny webserver on port 80 inside the container, and simply returns some OS and HTTP information.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;-p 8000:80&lt;/code&gt; option tells docker to map port 80 inside the container to port 8000 on the host.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;But on which host?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Check which host (NODE) the container is running on using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker service ps &lt;span class="nb"&gt;whoami&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s say the container is running on node2.&lt;/p&gt;

&lt;p&gt;How can we confirm that the &lt;code&gt;ingress&lt;/code&gt; network is being used?&lt;/p&gt;

&lt;p&gt;Switch to the node2 terminal and get the container ID:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;CONTAINER_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;docker ps &lt;span class="nt"&gt;--filter&lt;/span&gt; &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;whoami.1 &lt;span class="nt"&gt;--format&lt;/span&gt; &lt;span class="s1"&gt;'{{.ID}}'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then &lt;code&gt;inspect&lt;/code&gt; its network:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker inspect &lt;span class="nv"&gt;$CONTAINER_ID&lt;/span&gt; &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'{{json .NetworkSettings.Networks}}'&lt;/span&gt; | jq &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see a json object named &lt;code&gt;ingress&lt;/code&gt;, confirming our hypothesis.&lt;/p&gt;

&lt;p&gt;Since the service has been published on port 8000, if we send a request with curl from node2, like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl 127.0.0.1:8000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will get something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Hostname: fb772a20940c
IP: 127.0.0.1
IP: 10.0.0.28
IP: 172.18.0.3
RemoteAddr: 10.0.0.3:59882
GET / HTTP/1.1
Host: 127.0.0.1:8000
User-Agent: curl/7.64.0
Accept: &lt;span class="k"&gt;*&lt;/span&gt;/&lt;span class="k"&gt;*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Not surprising.&lt;/p&gt;

&lt;p&gt;But the cool thing is, if you try to run the same curl command on the other hosts, you will still get the same response (except for &lt;code&gt;RemoteAddr&lt;/code&gt;), even though those nodes don’t have the container running in them. Try it out!&lt;/p&gt;

&lt;p&gt;Why is that?&lt;/p&gt;

&lt;p&gt;All swarm nodes participate in an ingress &lt;strong&gt;routing mesh&lt;/strong&gt;. The routing mesh enables each node in the swarm to accept connections on published ports for any service running in the swarm, even if there’s no container running on the node.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--unLHzlpi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cpc7ch1ech6727phzxy8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--unLHzlpi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cpc7ch1ech6727phzxy8.png" alt="1 replica ingress" width="880" height="556"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This means, whenever a docker swarm service publishes a port (with &lt;code&gt;-p&lt;/code&gt;/&lt;code&gt;--publish&lt;/code&gt;), that service is reachable on that port across all swarm nodes. The overlay network is responsible for routing the traffic to the correct container on the correct node.&lt;/p&gt;

&lt;p&gt;But what if there are more than 1 containers?&lt;/p&gt;

&lt;p&gt;Let’s find out!&lt;/p&gt;

&lt;p&gt;Running multiple containers of a service is as simple as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker service scale &lt;span class="nb"&gt;whoami&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a few seconds, we should have 3 replicas of the whoami container running.&lt;/p&gt;

&lt;p&gt;Check which host (NODE) the containers are running on using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker service ps &lt;span class="nb"&gt;whoami&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We should see that all 3 nodes are assigned a container.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a_z9sK_G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xgpl2mlpbiunqta2e2m1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a_z9sK_G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xgpl2mlpbiunqta2e2m1.png" alt="3 replica ingress" width="880" height="556"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Docker swarm is smart enough to distribute the container workload among the available nodes.&lt;/p&gt;

&lt;p&gt;If we now curl again on any of the nodes with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl 127.0.0.1:8000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We should see that the Hostnames and IPs are also changing.&lt;/p&gt;

&lt;p&gt;This is because, containers running under a swarm service on the overlay network are automatically load-balanced!&lt;/p&gt;

&lt;p&gt;Awesome.&lt;/p&gt;

&lt;p&gt;Now, what if we want to attach a standalone container (not a swarm service) on the overlay network, for example to communicate across hosts?&lt;/p&gt;

&lt;p&gt;If we try to do the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--network&lt;/span&gt; ingress &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--name&lt;/span&gt; app1 &lt;span class="se"&gt;\&lt;/span&gt;
    nginx:alpine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will raise an error like “PermissionDenied desc = network ingress not manually attachable.”&lt;/p&gt;

&lt;p&gt;The default overlay network (&lt;code&gt;ingress&lt;/code&gt;) doesn’t allow attaching standalone containers. For that, we can use…&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;User-defined Overlay Networks&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;At first, we have to create a network with the overlay driver option:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker network create &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--driver&lt;/span&gt; overlay &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--attachable&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    my-overlay
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By using the &lt;code&gt;--attachable&lt;/code&gt; flag, docker will allow us to attach standalone containers to it.&lt;/p&gt;

&lt;p&gt;If we try to run a standalone container again but this time using our custom overlay network &lt;code&gt;my-overlay&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--network&lt;/span&gt; my-overlay &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--name&lt;/span&gt; app1 &lt;span class="se"&gt;\&lt;/span&gt;
    nginx:alpine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;it should work.&lt;/p&gt;

&lt;p&gt;Since app1 is lonely, let’s run a service with 3 replicas (containers) on &lt;code&gt;my-overlay&lt;/code&gt; as well:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker service create &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--name&lt;/span&gt; web &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--network&lt;/span&gt; my-overlay &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--replicas&lt;/span&gt; 3 &lt;span class="se"&gt;\&lt;/span&gt;
    nginx:alpine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NOTE: we have not published any ports, but this image runs &lt;a href="https://www.nginx.com/"&gt;nginx&lt;/a&gt; server on port 80 inside the container.&lt;/p&gt;

&lt;p&gt;Now, &lt;code&gt;web&lt;/code&gt; service containers can communicate with &lt;code&gt;app1&lt;/code&gt; container and vice versa!&lt;/p&gt;

&lt;p&gt;Really?&lt;/p&gt;

&lt;p&gt;Try to reach &lt;code&gt;web&lt;/code&gt; service from &lt;code&gt;app1&lt;/code&gt; simply by using the name of the service with curl:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;app1 curl web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It should print out the &lt;code&gt;index.html&lt;/code&gt; page of nginx.&lt;/p&gt;

&lt;p&gt;To test the other way around ie. communication from &lt;code&gt;web&lt;/code&gt; service to &lt;code&gt;app1&lt;/code&gt;, first, get the container id of a &lt;code&gt;web&lt;/code&gt; service container.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;CONTAINER_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;docker ps &lt;span class="nt"&gt;--filter&lt;/span&gt; &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;web &lt;span class="nt"&gt;--format&lt;/span&gt; &lt;span class="s1"&gt;'{{.ID}}'&lt;/span&gt; | &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; 1&lt;span class="si"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then use exec again to curl &lt;code&gt;app1&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nv"&gt;$CONTAINER_ID&lt;/span&gt; curl app1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See the nginx index page?&lt;/p&gt;

&lt;p&gt;Congratulations! You now know how to use overlay networks! 🎉&lt;/p&gt;

&lt;p&gt;Of course, there’s a lot more to it but we have covered the essentials. Feel free to learn more from &lt;a href="https://docs.docker.com/network/overlay"&gt;the official docs&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Clean up&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Let’s clean up our mess.&lt;/p&gt;

&lt;p&gt;Remove &lt;code&gt;app1&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; app1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then remove the services from the manager node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker service &lt;span class="nb"&gt;rm whoami &lt;/span&gt;web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the services are down, remove the custom overlay:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker network &lt;span class="nb"&gt;rm &lt;/span&gt;my-overlay
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, remove each of the worker nodes from the swarm (by running on each worker node):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker swarm leave
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, make the manager leave the swarm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker swarm leave &lt;span class="nt"&gt;--force&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Well done! 👏&lt;/p&gt;

&lt;h1&gt;
  
  
  When to use the &lt;code&gt;overlay&lt;/code&gt; driver? - possible use cases
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;If you have multiple nodes to deploy your containerized workloads, but you have a small team with limited containerization experience.&lt;/li&gt;
&lt;li&gt;If you need a simple container orchestrator like docker swarm, but do not have the time/resources to invest in more complex orchestrators like Kubernetes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Limitations of the &lt;code&gt;overlay&lt;/code&gt; driver&lt;/strong&gt;
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;overlay&lt;/code&gt; driver is slower than &lt;code&gt;host&lt;/code&gt; driver&lt;/strong&gt;: If you need the highest network performance and your workload is running on a single host, or you are okay with setting up the OS level routing by yourself, then the &lt;code&gt;host&lt;/code&gt; driver would be more suitable than &lt;code&gt;overlay&lt;/code&gt;. This is because &lt;code&gt;host&lt;/code&gt; driver directly uses the host’s network, instead of having to setup separate interfaces, and port-mapping configurations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker (swarm) does not natively support autoscaling&lt;/strong&gt;: autoscaling is not supported out of the box as you need to provision new infrastructure/servers which is out of the scope of docker. There are 3rd party tools/scripts that can help, but if you really need the ability to autoscale, you should consider something like Kubernetes or AWS ECS.&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this blog, we learnt about the &lt;code&gt;overlay&lt;/code&gt; network driver in docker - what it is, how to use it, and some possible use cases and limitations.&lt;/p&gt;

&lt;p&gt;By connecting multiple docker daemons in a swarm, the &lt;code&gt;overlay&lt;/code&gt; driver simplifies multi-host networking. But its drawbacks are to be kept in mind, especially when using it in production.&lt;/p&gt;

&lt;p&gt;I hope I could make things clearer for you, be it just a tiny bit.&lt;/p&gt;

&lt;p&gt;In the next blog, we will summarize what we learnt in this docker networking series.&lt;/p&gt;

&lt;p&gt;Thanks for making it so far! 👏&lt;/p&gt;

&lt;p&gt;See you at the next one.&lt;/p&gt;

&lt;p&gt;Till then…&lt;/p&gt;

&lt;p&gt;Be bold and keep learning.&lt;/p&gt;

&lt;p&gt;But most importantly,&lt;/p&gt;

&lt;p&gt;Tech care!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>cloud</category>
      <category>networking</category>
    </item>
    <item>
      <title>The Bridge Network Driver | Networking in Docker #6</title>
      <dc:creator>Farhim Ferdous</dc:creator>
      <pubDate>Wed, 15 Jun 2022 14:10:12 +0000</pubDate>
      <link>https://dev.to/alubhorta/the-bridge-network-driver-networking-in-docker-6-1ahf</link>
      <guid>https://dev.to/alubhorta/the-bridge-network-driver-networking-in-docker-6-1ahf</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Learn what the Bridge driver is in Docker, how it simplifies multi-container networking on a single host, how to use it, possible use cases and limitations&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Link to video: &lt;a href="https://www.youtube.com/watch?v=Z5QLPkp-Ogo" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=Z5QLPkp-Ogo&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;What is the &lt;code&gt;bridge&lt;/code&gt; network driver in Docker and how does it simplify networking on a single host?&lt;/p&gt;

&lt;p&gt;This blog will try to answer that (and more) as simply as possible.&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;This blog is the sixth one in a series for Docker Networking.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-1-why-is-networking-important/" rel="noopener noreferrer"&gt;blog #1 - &lt;strong&gt;Why is Networking important in Docker?&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-2-basics-of-networking/" rel="noopener noreferrer"&gt;blog #2 - &lt;strong&gt;Basics of Networking&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://techmormo.com/posts/docker-networking-3-drivers-overview/" rel="noopener noreferrer"&gt;blog #3 - &lt;strong&gt;Docker Network Drivers Overview&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-4-none-driver/" rel="noopener noreferrer"&gt;blog #4 - &lt;strong&gt;None Network Driver&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://techmormo.com/posts/docker-networking-5-host-driver/" rel="noopener noreferrer"&gt;blog #5 - &lt;strong&gt;Host Network Driver&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are looking to learn more about the basics of Docker, I’ll recommend checking out the &lt;a href="https://www.techmormo.com/posts/docker-made-easy-1-what-is-docker/" rel="noopener noreferrer"&gt;Docker Made Easy&lt;/a&gt; series.&lt;/p&gt;

&lt;p&gt;Here’s the agenda for this blog:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is the &lt;code&gt;bridge&lt;/code&gt; network driver?&lt;/li&gt;
&lt;li&gt;How to use it?&lt;/li&gt;
&lt;li&gt;When to use it? - possible use cases&lt;/li&gt;
&lt;li&gt;its limitations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here are some quick reminders:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;Docker host&lt;/strong&gt; is a physical or virtual machine that runs the Docker daemon.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Network drivers&lt;/strong&gt; enable us to easily use multiple types of networks for containers and hide the complexity required for network implementations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Alright, so...&lt;/p&gt;

&lt;h1&gt;
  
  
  What is the &lt;code&gt;bridge&lt;/code&gt; driver?
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;A &lt;code&gt;bridge&lt;/code&gt; driver can be used to create an internal network within a &lt;em&gt;single&lt;/em&gt; Docker host.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1kapx9fwe15vs91ddwm3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1kapx9fwe15vs91ddwm3.png" alt="Bridge driver"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A network created using the bridge driver forms a namespace that is separate from the host's network namespace. Therefore, containers running on bridge networks are isolated from the host's network.&lt;/p&gt;

&lt;p&gt;This driver is used most often for applications that require one or more containers running on a single host.&lt;/p&gt;

&lt;p&gt;When Docker is started, it automatically creates a default bridge network named &lt;code&gt;bridge&lt;/code&gt;, and uses it for containers that do not specify any networks explicitly. We can also create many custom ‘user-defined’ bridge networks.&lt;/p&gt;

&lt;p&gt;User-defined bridge networks are superior to the default &lt;code&gt;bridge&lt;/code&gt; network in the following ways…&lt;/p&gt;

&lt;h1&gt;
  
  
  Differences between default bridge and User-defined bridge networks
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;User-defined bridges provide automatic DNS resolution between containers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Containers on the default bridge network can only access each other by IP addresses, unless you manually create links using the &lt;code&gt;--link&lt;/code&gt; option, which is considered legacy. These links need to be created in both directions, so this gets increasingly more complex the more containers there are to communicate.&lt;br&gt;
On a user-defined bridge network, containers can resolve each other by name or alias. Imagine an application with a web front-end and a database back-end. If you call your containers &lt;code&gt;web&lt;/code&gt; and &lt;code&gt;db&lt;/code&gt;, the web container can connect to the db container using the hostname &lt;code&gt;db&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;User-defined bridges provide better isolation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;All containers without a &lt;code&gt;--network&lt;/code&gt; specified, are attached to the default bridge network, which can be a risk, as unrelated stacks/services/containers are then able to communicate.&lt;/p&gt;

&lt;p&gt;Using a user-defined network provides a scoped network in which only containers attached to that network are able to communicate.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Containers can be attached and detached from user-defined networks on the fly&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To remove a container from the default bridge network, you need to stop the container and recreate it with different network options.&lt;/p&gt;

&lt;p&gt;But you can connect or disconnect containers from user-defined networks on the fly.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Each user-defined network creates a configurable bridge&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If your containers use the default bridge network, you can configure it, but all the containers use the same settings, such as MTU and &lt;code&gt;iptables&lt;/code&gt; rules. In addition, configuring the default bridge network happens outside of Docker itself, and requires a restart of the Docker Daemon.&lt;/p&gt;

&lt;p&gt;User-defined bridge networks are created and configured using &lt;code&gt;docker network create&lt;/code&gt; command. If different groups of applications have different network requirements, you can configure each user-defined bridge separately.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Linked containers on the default bridge network share environment variables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Originally, the only way to share environment variables between two containers was to link them using the &lt;code&gt;--link&lt;/code&gt; flag. Although this is not possible with user-defined networks, there are better alternatives for sharing environment variables like:&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- sharing files using Docker Volumes
- sharing variables from a `docker-compose` configuration when using Docker Compose
- using Docker Secrets and/or Docker Configs when using Docker Swarm Services
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  How to use the &lt;code&gt;bridge&lt;/code&gt; driver?
&lt;/h1&gt;

&lt;p&gt;I encourage you to follow along with the hands-on lab that follows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Demo: Default bridge network with cli&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s start off by running two nginx containers (in the background with &lt;code&gt;-d&lt;/code&gt;) named app1 and app2:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; app1 nginx:alpine
docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; app2 nginx:alpine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As discussed previously, when no particular &lt;code&gt;--network&lt;/code&gt; is specified from the cli, the default &lt;code&gt;bridge&lt;/code&gt; network is used.&lt;/p&gt;

&lt;p&gt;We can check that nginx is in fact running on both containers by using &lt;code&gt;docker exec&lt;/code&gt; to run &lt;code&gt;curl localhost&lt;/code&gt; on both containers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;app1 curl localhost
docker &lt;span class="nb"&gt;exec &lt;/span&gt;app2 curl localhost
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On success, this would print out the index.html page of nginx.&lt;/p&gt;

&lt;p&gt;Footnotes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;docker exec&lt;/code&gt; is used to execute a command inside a running container.&lt;/li&gt;
&lt;li&gt;nginx runs on port 80 inside its container.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;curl localhost&lt;/code&gt; is the same as &lt;code&gt;curl http://localhost:80&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now let’s try to communicate between the containers.&lt;/p&gt;

&lt;p&gt;Trying to reach app2 from app1 using the hostname app2 will not work since DNS doesn’t work out of the box with the default bridge.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;app1 curl app2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s get the IP address of app2 with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker inspect &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="s1"&gt;'{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}'&lt;/span&gt; app2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On my system, it is &lt;code&gt;172.17.0.3&lt;/code&gt; (could be different in yours).&lt;/p&gt;

&lt;p&gt;If we now try to reach app2 from app1 again, but with the IP address:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;app1 curl 172.17.0.3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We should see that it works!&lt;/p&gt;

&lt;p&gt;Using IP addresses is neither reliable nor easy to maintain since more containers could be added to the default network.&lt;/p&gt;

&lt;p&gt;If we used the legacy &lt;code&gt;--link&lt;/code&gt; option, we could have used the name of the container instead of the IP. But there are major drawbacks to using the default bridge (as discussed in the previous section), and using the &lt;code&gt;--link&lt;/code&gt; is discouraged.&lt;/p&gt;

&lt;p&gt;So, let’s directly go to…&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Demo: User-defined bridge network with cli&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A user-defined bridge network has to be created before it can be used. So let’s create one named &lt;code&gt;my-bridge&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker network create &lt;span class="nt"&gt;--driver&lt;/span&gt; bridge my-bridge
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NOTE: since bridge is the default network driver, specifying &lt;code&gt;--driver bridge&lt;/code&gt; in the command is optional.&lt;/p&gt;

&lt;p&gt;We will run two containers again and name them app3 and app4:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; app3 &lt;span class="nt"&gt;--network&lt;/span&gt; my-bridge nginx:alpine
docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; app4 &lt;span class="nt"&gt;--network&lt;/span&gt; my-bridge nginx:alpine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Again, let’s test if nginx is running properly on both containers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;app3 curl localhost
docker &lt;span class="nb"&gt;exec &lt;/span&gt;app4 curl localhost
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On successfully printing the index pages, let’s move on to communication between the containers.&lt;/p&gt;

&lt;p&gt;If we try to reach app4 from app3 using the hostname app4:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;app3 curl app4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will see that it will succeed!&lt;/p&gt;

&lt;p&gt;The same thing will also work when reaching app3 from app4:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;app4 curl app3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Will we be able to reach app2 from app3 using DNS?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;app3 curl app2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nope.&lt;/p&gt;

&lt;p&gt;What about using app2’s IP address? (connection timeout added to not keep curl waiting indefinitely)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;app3 curl 172.17.0.3 &lt;span class="nt"&gt;--connect-timeout&lt;/span&gt; 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No again.&lt;/p&gt;

&lt;p&gt;We cannot reach app2 from app3 (or app4) and vice versa because they are on two separate networks, the default &lt;code&gt;bridge&lt;/code&gt; and our user-defined &lt;code&gt;my-bridge&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Demo: publishing container ports&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Containers connected to the same bridge network effectively expose all ports to each other. For a container port to be accessible from the host machine or from hosts of external networks, that container port must be &lt;em&gt;published&lt;/em&gt; using the &lt;code&gt;-p&lt;/code&gt;  or &lt;code&gt;--publish&lt;/code&gt;  flag.&lt;/p&gt;

&lt;p&gt;Let’s see this in action.&lt;/p&gt;

&lt;p&gt;All the existing containers have nginx running inside them separately on port 80 of each container, but none of them can be reached from the host’s port 80 yet. We can confirm by running curl on the host:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl localhost
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Assuming you didn’t have any applications running on port 80, curl should return an error like “Connection refused”.&lt;/p&gt;

&lt;p&gt;If we want the container’s application (in this case nginx) to be reachable from the host, we can publish its port (i.e. map the container's port to a host port).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; app5 &lt;span class="nt"&gt;-p&lt;/span&gt; 3000:80 nginx:alpine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will map port 3000 on the host to port 80 inside the container.&lt;/p&gt;

&lt;p&gt;If we now try to curl on port 3000 of the host:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl localhost:3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We should see the nginx index page.&lt;/p&gt;

&lt;p&gt;Nice work! :)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Clean up&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We can remove all containers on the system using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;docker ps &lt;span class="nt"&gt;-aq&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NOTE: this will also remove any containers you had in your system previously before this tutorial.&lt;/p&gt;

&lt;p&gt;Let’s also remove the &lt;code&gt;my-bridge&lt;/code&gt; as well.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker network &lt;span class="nb"&gt;rm &lt;/span&gt;my-bridge
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All clean! ✨&lt;/p&gt;

&lt;h1&gt;
  
  
  When to use the &lt;code&gt;bridge&lt;/code&gt; driver? - possible use cases
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;When Multi-Container Networking is required on a single host&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Networks created by using the bridge driver are contained within a single host, therefore it is ideal for most workloads that run on a single machine, like an engineer's local development environment or a company that runs multiple applications on a single server, etc.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;When using Docker Compose&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Docker Compose simplifies running multi-container workloads, especially on a single machine. It does so by using a YAML configuration file (&lt;code&gt;docker-compose.yaml&lt;/code&gt;) like the following example:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;version: &lt;span class="s2"&gt;"3.1"&lt;/span&gt;

services:
    nginx:
        image: nginx:alpine
        ports:
            - 80:80
    web:
        image: myapp-custom-image
    mysql:
        image: mysql
&lt;span class="c"&gt;# ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;This file specifies a set of services that use docker images to run containers, and bridge networks are setup to enable inter-container communication. Compose creates and uses user-defined bridge networks out of the box when its services are first created using the &lt;code&gt;docker-compose up&lt;/code&gt; command. It also removes the user-defined bridge networks created when services are taken down with &lt;code&gt;docker-compose down&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;NOTE: We will learn more about the awesome Docker Compose tool in an upcoming post, so, stay tuned.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you know of any other use cases for bridge driver, please let us know.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Limitations of the&lt;/strong&gt; &lt;code&gt;bridge&lt;/code&gt; &lt;strong&gt;driver&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Limited to a single host&lt;/strong&gt;:
The bridge driver provides seamless network isolation for containers on a single host only. If networking between multiple hosts is required, either the Overlay driver (recommended) or some custom OS level routing has to be implemented.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;bridge&lt;/code&gt; driver is slower than &lt;code&gt;host&lt;/code&gt; driver&lt;/strong&gt;:
Since an internal network has to be created and ports have to be mapped (via NAT/userland-proxy) for &lt;code&gt;bridge&lt;/code&gt; driver, it incurs more overhead in terms of raw network performance at the cost of providing better isolation than the &lt;code&gt;host&lt;/code&gt; driver. If you are not running multiple containers on a single production machine or if a very high network throughput is required, then the &lt;code&gt;host&lt;/code&gt; driver might provide a better alternative to &lt;code&gt;bridge&lt;/code&gt; due to its faster performance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;default &lt;code&gt;bridge&lt;/code&gt; drawbacks&lt;/strong&gt;:
As discussed previously in the section ‘Differences between default bridge and User-defined bridge networks’, the default bridge is far inferior to user-defined ones. The default &lt;code&gt;bridge&lt;/code&gt; network is considered a legacy detail of Docker and is not recommended for production use.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this blog, we learnt about the &lt;code&gt;bridge&lt;/code&gt; network driver in docker - what it is, how to use it, and some possible use cases and limitations.&lt;/p&gt;

&lt;p&gt;By creating an internal network, the &lt;code&gt;bridge&lt;/code&gt; driver simplifies network isolation on a single host. But its drawbacks are to be kept in mind, especially when using it in production.&lt;/p&gt;

&lt;p&gt;I hope I could make things clearer for you, be it just a tiny bit.&lt;/p&gt;

&lt;p&gt;In the next blog, we will learn about the &lt;code&gt;overlay&lt;/code&gt; driver - which simplifies multi-host container networking.&lt;/p&gt;

&lt;p&gt;Thanks for making it so far! 👏&lt;/p&gt;

&lt;p&gt;See you at the next one.&lt;/p&gt;

&lt;p&gt;Till then…&lt;/p&gt;

&lt;p&gt;Be bold and keep learning.&lt;/p&gt;

&lt;p&gt;But most importantly,&lt;/p&gt;

&lt;p&gt;Tech care!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>networking</category>
      <category>cloud</category>
    </item>
    <item>
      <title>The Host Network Driver | Networking in Docker #5</title>
      <dc:creator>Farhim Ferdous</dc:creator>
      <pubDate>Sun, 13 Mar 2022 01:26:37 +0000</pubDate>
      <link>https://dev.to/alubhorta/the-host-network-driver-networking-in-docker-5-855</link>
      <guid>https://dev.to/alubhorta/the-host-network-driver-networking-in-docker-5-855</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Learn what the Host driver is, how it provides the best performance, how to use it, possible use cases and limitations&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Link to video: &lt;a href="https://www.youtube.com/watch?v=qice7-Cfgzw"&gt;https://www.youtube.com/watch?v=qice7-Cfgzw&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;What is the &lt;code&gt;host&lt;/code&gt; network driver in Docker and how does it provide the best network performance?&lt;/p&gt;

&lt;p&gt;This blog will try to answer that (and more) as simply as possible.&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;This blog is the fifth one in a series for Docker Networking.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-1-why-is-networking-important/"&gt;blog #1 - &lt;strong&gt;Why is Networking important in Docker?&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-2-basics-of-networking/"&gt;blog #2 - &lt;strong&gt;Basics of Networking&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://techmormo.com/posts/docker-networking-3-drivers-overview/"&gt;blog #3 - &lt;strong&gt;Docker Network Drivers Overview&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-4-none-driver/"&gt;blog #4 - &lt;strong&gt;None Network Driver&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are looking to learn more about the basics of Docker, I’ll recommended checking out the &lt;a href="https://www.techmormo.com/posts/docker-made-easy-1-what-is-docker/"&gt;Docker Made Easy&lt;/a&gt; series.&lt;/p&gt;

&lt;p&gt;Here’s the agenda for this blog:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is the &lt;code&gt;host&lt;/code&gt; network driver?&lt;/li&gt;
&lt;li&gt;How to use it?&lt;/li&gt;
&lt;li&gt;When to use it? - possible use cases&lt;/li&gt;
&lt;li&gt;its limitations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here are some quick reminders:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;Docker host&lt;/strong&gt; is the physical or virtual machine that runs the Docker daemon.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Network drivers&lt;/strong&gt; enable us to easily use multiple types of networks for containers and hide the complexity required for network implementations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Alright, so...&lt;/p&gt;

&lt;h1&gt;
  
  
  What is the &lt;code&gt;host&lt;/code&gt; driver?
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;When a container uses the &lt;code&gt;host&lt;/code&gt; network driver, the container shares the network stack (namespace) of its host.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--E3PoFUfo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7t0u31kghoibasibqlgt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--E3PoFUfo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7t0u31kghoibasibqlgt.png" alt="host driver" width="880" height="852"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This means the network of the container is not virtualized, making the container appear as if it is the host itself, from a networking perspective.&lt;/p&gt;

&lt;p&gt;A direct consequence of this is that - if a container using the &lt;code&gt;host&lt;/code&gt; driver publishes a port, let’s say 8000, then that port will also be published on the host machine. If that port is already in use, then the container will not start successfully.&lt;/p&gt;

&lt;p&gt;However, in all other ways - like storage, process, and user namespace, the container is isolated from the host.&lt;/p&gt;

&lt;p&gt;NOTE: the &lt;code&gt;host&lt;/code&gt; driver is only supported on Linux as of now i.e. host driver is not available on Mac or Windows platforms.&lt;/p&gt;

&lt;h1&gt;
  
  
  How to use the &lt;code&gt;host&lt;/code&gt; driver?
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Example without specifying any network - using default &lt;code&gt;bridge&lt;/code&gt; driver&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s start off by running an nginx container named &lt;code&gt;app1&lt;/code&gt; in the background (&lt;code&gt;-d&lt;/code&gt;) without specifying any network:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; app1 nginx:alpine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The nginx container by default maps onto port 80 inside the container. Docker uses the default &lt;code&gt;bridge&lt;/code&gt; network driver if no driver is specified.&lt;/p&gt;

&lt;p&gt;If we use curl localhost inside the container, we’ll see nginx the nginx index page successfully:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# works&lt;/span&gt;
docker &lt;span class="nb"&gt;exec &lt;/span&gt;app1 curl localhost
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;NOTE: Did you know port 80 is the default HTTP port? Therefore &lt;code&gt;curl localhost&lt;/code&gt; automatically refers to &lt;code&gt;curl http://localhost:80&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But if we try to curl localhost from the host machine, it will fail:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# fails&lt;/span&gt;
curl localhost
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is because we cannot reach the nginx container from the host, as the host and the container are using separate network namespaces (when using the default &lt;code&gt;bridge&lt;/code&gt; network).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The solution is &lt;em&gt;port mapping&lt;/em&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let’s remove &lt;code&gt;app1&lt;/code&gt; and create it again using the &lt;em&gt;port mapping&lt;/em&gt; &lt;code&gt;-p&lt;/code&gt; &lt;em&gt;option:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; app1

docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; app1 &lt;span class="nt"&gt;-p&lt;/span&gt; 2000:80 nginx:alpine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The port mapping option  &lt;em&gt;(&lt;/em&gt;&lt;code&gt;-p 2000:80&lt;/code&gt;&lt;em&gt;)&lt;/em&gt; instructs Docker to map port 2000 on the host to port 80 on the container.&lt;/p&gt;

&lt;p&gt;Let’s check out results using curl:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# fails&lt;/span&gt;
curl localhost

&lt;span class="c"&gt;# works&lt;/span&gt;
curl localhost:2000

&lt;span class="c"&gt;# works&lt;/span&gt;
docker &lt;span class="nb"&gt;exec &lt;/span&gt;app1 curl localhost
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We’ll learn more about &lt;code&gt;bridge&lt;/code&gt; drivers in the next part of this series.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example using &lt;code&gt;host&lt;/code&gt; driver&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As we’d learnt, when using the host driver, the network stack is the same for both the container and host, so there’s no need for port mapping. Let’s check it out.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;NOTE: you need a Linux machine to use the &lt;code&gt;host&lt;/code&gt; driver.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We’ll run a similar nginx container named &lt;code&gt;app2&lt;/code&gt; using the &lt;code&gt;host&lt;/code&gt; driver:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; app2 &lt;span class="nt"&gt;--network&lt;/span&gt; host nginx:alpine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Curling localhost will now work:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# works&lt;/span&gt;
curl localhost
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Can you guess why?&lt;/p&gt;

&lt;p&gt;The answer will be clear if we...&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check differences in IP configuration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s first look at IP addresses assigned to all network interfaces on the host machine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ip addr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note the number of interfaces and the associated IPs.&lt;/p&gt;

&lt;p&gt;What happens if we execute the same command inside the &lt;code&gt;app1&lt;/code&gt; container (the one using the default &lt;code&gt;bridge&lt;/code&gt; driver)?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;app1 ip addr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We should certainly see differences between the configuration in the host machine and &lt;code&gt;app1&lt;/code&gt;, since they are using different network namespaces.&lt;/p&gt;

&lt;p&gt;Now let’s try that for &lt;code&gt;app2&lt;/code&gt; container (the one using the &lt;code&gt;host&lt;/code&gt; driver):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;app2 ip addr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You’ll notice that the network configuration is exactly the same as for the host machine.&lt;/p&gt;

&lt;p&gt;This is a clear indication that &lt;code&gt;host&lt;/code&gt; driver makes the container share the host machines network.&lt;/p&gt;

&lt;p&gt;One consequence of using the host driver is...&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Port conflicts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You cannot run multiple containers that bind to the same port using &lt;code&gt;host&lt;/code&gt; driver.&lt;/p&gt;

&lt;p&gt;To demonstrate this, we’ll try to run a very similar nginx container to &lt;code&gt;app2&lt;/code&gt;, but named as &lt;code&gt;app3&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; app3 &lt;span class="nt"&gt;--network&lt;/span&gt; host nginx:alpine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we check the logs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker logs &lt;span class="nt"&gt;-f&lt;/span&gt; app3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We’ll notice that nginx failed to start because the port it tried to bind to (80) was already in use.&lt;/p&gt;

&lt;p&gt;We can confirm that &lt;code&gt;app3&lt;/code&gt; exited:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker ps &lt;span class="nt"&gt;-a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Cleanup&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To end the hands-on lab, we’ll clean up the containers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; app1 app2 app3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Now that we have seen it in action, let’s learn...&lt;/p&gt;

&lt;h1&gt;
  
  
  When to use the &lt;code&gt;host&lt;/code&gt; driver? - possible use cases
&lt;/h1&gt;

&lt;p&gt;The following are some use cases where the &lt;code&gt;host&lt;/code&gt; driver could be suitable.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;When the highest network performance is required&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;host&lt;/code&gt; network driver provides the best network performance compared to the other drivers since it uses the network namespace of the host machine directly and does not require port-mapping / network address translation (NAT).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;When a single container needs to handle a large number of ports&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If our workload demands a container to handle a large number of ports, then it might be preferable to use the &lt;code&gt;host&lt;/code&gt; network directly, instead of mapping each port to the host one by one.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;When network isolation is not required&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This can actually simplify our networking since we won’t need to bother with port mapping or NAT.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Given its properties in mind, we should be aware of the...&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Limitations of the &lt;code&gt;host&lt;/code&gt; driver&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Lack of network isolation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As the container’s network is not virtualized using &lt;code&gt;host&lt;/code&gt;, it may not provide the level of isolation required for many multi-container workloads. &lt;/p&gt;

&lt;p&gt;Additionally, any networking configuration applied to the host machine will also be applied to the container. If the container is deployed in privileged mode, the container could reconfigure the host’s network stack as well.&lt;/p&gt;

&lt;p&gt;This tight binding with the host machine could raise bugs or security issues.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Port conflicts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As we have seen, we cannot run multiple containers that use the same port when using the &lt;code&gt;host&lt;/code&gt; driver.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Only works on Linux machines&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;host&lt;/code&gt; driver is only supported on Linux, not on Docker Desktop for Mac or Windows.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this blog, we learnt about the &lt;code&gt;host&lt;/code&gt; network driver in docker - what it is, how to use it, some possible use cases and its limitations.&lt;/p&gt;

&lt;p&gt;By not providing network isolation, the host driver provides the best performance and simplicity. But its drawbacks are to be kept in mind when using the &lt;code&gt;host&lt;/code&gt; driver in production.&lt;/p&gt;

&lt;p&gt;I hope I could make things clearer for you, be it just a tiny bit.&lt;/p&gt;

&lt;p&gt;In the next blog, we will learn about the &lt;code&gt;bridge&lt;/code&gt; driver - the default network driver, that is likely used the most in development environments.&lt;/p&gt;

&lt;p&gt;Thanks for making it so far! 👏&lt;/p&gt;

&lt;p&gt;See you at the next one.&lt;/p&gt;

&lt;p&gt;Till then…&lt;/p&gt;

&lt;p&gt;Be bold and keep learning.&lt;/p&gt;

&lt;p&gt;But most importantly,&lt;/p&gt;

&lt;p&gt;Tech care!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>networking</category>
      <category>containers</category>
      <category>devops</category>
    </item>
    <item>
      <title>The None Network Driver | Networking in Docker #4</title>
      <dc:creator>Farhim Ferdous</dc:creator>
      <pubDate>Sat, 12 Feb 2022 11:02:50 +0000</pubDate>
      <link>https://dev.to/alubhorta/the-none-network-driver-networking-in-docker-4-4m3o</link>
      <guid>https://dev.to/alubhorta/the-none-network-driver-networking-in-docker-4-4m3o</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Learn what the None driver is, how it enables network isolation, how to use it, and possible use cases&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Link to video: &lt;a href="https://www.youtube.com/watch?v=LmZMTQd_y9M" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=LmZMTQd_y9M&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;What is the &lt;code&gt;none&lt;/code&gt; network driver in Docker and how can it help me run secure, network-isolated containers?&lt;/p&gt;

&lt;p&gt;This blog will try to answer that as simply as possible.&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;This blog is the fourth one in a series for Docker Networking.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-1-why-is-networking-important/" rel="noopener noreferrer"&gt;blog #1 - &lt;strong&gt;Why is Networking important in Docker?&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-2-basics-of-networking/" rel="noopener noreferrer"&gt;blog #2 - &lt;strong&gt;Basics of Networking&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://techmormo.com/posts/docker-networking-3-drivers-overview/" rel="noopener noreferrer"&gt;blog #3 - &lt;strong&gt;Docker Network Drivers Overview&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are looking to learn more about the basics of Docker, I’ll recommended checking out the &lt;a href="https://www.techmormo.com/posts/docker-made-easy-1-what-is-docker/" rel="noopener noreferrer"&gt;Docker Made Easy&lt;/a&gt; series.&lt;/p&gt;

&lt;p&gt;Here’s the agenda for this blog:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is the &lt;code&gt;none&lt;/code&gt; network driver?&lt;/li&gt;
&lt;li&gt;How to use it?&lt;/li&gt;
&lt;li&gt;When to use it? - possible use cases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s start with a quick refresher: &lt;strong&gt;what are network drivers?&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Network drivers enable us to easily use multiple types of networks for containers and hide the complexity required for network implementations.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So...&lt;/p&gt;

&lt;h1&gt;
  
  
  What is the &lt;code&gt;none&lt;/code&gt; network driver?
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;none&lt;/code&gt; driver simply disables networking for a container, making it isolated from other containers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk9w543mp5117s7wuyxis.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk9w543mp5117s7wuyxis.png" alt="NONE Driver analogy"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Within the container, only the loopback interface is created to enable inter-process-communication, by using the IP address &lt;code&gt;127.0.0.1&lt;/code&gt; mapping to the name &lt;code&gt;localhost&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;But the absence of other network interfaces like &lt;code&gt;eth0&lt;/code&gt; means, neither can it reach external networks nor can external networks reach it.&lt;/p&gt;

&lt;p&gt;This makes the &lt;code&gt;none&lt;/code&gt; network driver very secure. But it also limits its usability, as we usually wish to enable communication between containers. &lt;/p&gt;

&lt;p&gt;We’ll later look at some possible use cases for &lt;code&gt;none&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For now, let’s learn...&lt;/p&gt;

&lt;h1&gt;
  
  
  How to use the &lt;code&gt;none&lt;/code&gt; network driver?
&lt;/h1&gt;

&lt;p&gt;First, we’ll run an interactive shell (&lt;code&gt;sh&lt;/code&gt;) within an &lt;code&gt;alpine&lt;/code&gt; Linux container named &lt;code&gt;app1&lt;/code&gt;, without specifying a network:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; app1 alpine sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;NOTE: the &lt;code&gt;-it&lt;/code&gt; flags connect your terminal’s input to the container’s one, giving you direct access to the shell running inside the container.&lt;/p&gt;

&lt;p&gt;Docker uses the default &lt;code&gt;bridge&lt;/code&gt; network driver if no driver is stated, which we will learn more about in an upcoming post.&lt;/p&gt;

&lt;p&gt;But the important thing to note is that this container has access to the internet.&lt;/p&gt;

&lt;p&gt;We can check that by pinging a web address like google.com:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ping google.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or by running the apk update command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apk update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They should work.&lt;/p&gt;

&lt;p&gt;We can check the network interfaces and IP addresses by using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ip addr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This shows detailed configurations for each network interface.&lt;/p&gt;

&lt;p&gt;The two primary interfaces of interest are the loopback (having the familiar &lt;code&gt;127.0.0.1&lt;/code&gt; address), and the ethernet interface (named &lt;code&gt;eth0&lt;/code&gt; or similar). The loopback allows processes within the container to communicate with each other, whereas, the ethernet interface within IP/&lt;code&gt;inet&lt;/code&gt; address connects the container to a network.&lt;/p&gt;

&lt;p&gt;NOTE: On some systems, additional tunnel interfaces (like &lt;code&gt;tunl0&lt;/code&gt;) might show up; we can ignore them for now.&lt;/p&gt;

&lt;p&gt;We can also check the presence of a route table that has a default route to a gateway:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;route
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All this was a way to confirm the presence of network connectivity. Don’t worry if you didn’t understand every single detail.&lt;/p&gt;

&lt;p&gt;Okay.&lt;/p&gt;

&lt;p&gt;Now let’s see how a container with the &lt;code&gt;none&lt;/code&gt; driver behaves.&lt;/p&gt;

&lt;p&gt;Let’s open up a new terminal tab/window and run a very similar container like before. This time we will specify the network to be &lt;code&gt;none&lt;/code&gt; and name it &lt;code&gt;app2&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; app2 &lt;span class="nt"&gt;--network&lt;/span&gt; none alpine sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Trying to access the internet now shall fail - like pinging the google URL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ping google.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or apk update&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apk update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we try to ping &lt;code&gt;localhost&lt;/code&gt;, it will surprisingly work:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ping localhost
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is because the loopback interface is present, as you can check with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ip addr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But you will notice that there are no ethernet interfaces.&lt;/p&gt;

&lt;p&gt;As well as no routes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;route
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thus, neither can &lt;code&gt;app2&lt;/code&gt; be reached from the outside nor vice versa.&lt;/p&gt;

&lt;p&gt;The only way we can connect to &lt;code&gt;app2&lt;/code&gt; is by using the &lt;code&gt;docker exec&lt;/code&gt; command, which is used to run a command inside a running container.&lt;/p&gt;

&lt;p&gt;Open up a third terminal tab/window and run the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;app2 ip addr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will show the list of interfaces and IP addresses of &lt;code&gt;app2&lt;/code&gt; we had seen earlier.&lt;/p&gt;

&lt;p&gt;If you want to start another interactive session, you can run another shell (&lt;code&gt;sh&lt;/code&gt;) and use &lt;code&gt;-it&lt;/code&gt; with &lt;code&gt;exec&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; app2 sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To exit the shell, use &lt;code&gt;ctrl+d&lt;/code&gt; or (&lt;code&gt;control+d&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Once we are done playing around, we can clean up the containers using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; app1 app2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  When to use the &lt;code&gt;none&lt;/code&gt; network driver? - possible use cases
&lt;/h1&gt;

&lt;p&gt;While I personally haven’t used the &lt;code&gt;none&lt;/code&gt; driver in production much during the several years that I have been exposed to containers, it might still be useful for cases that require strict network isolation.&lt;/p&gt;

&lt;p&gt;I could think of two niche use cases:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;To run network-isolated applications that only perform file operations&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This could be done by &lt;a href="https://techmormo.com/posts/docker-made-easy-4-persistence-and-docker-volumes/" rel="noopener noreferrer"&gt;mounting volumes&lt;/a&gt; to the container, which then, in turn, could perform operations after certain intervals or by detecting file change events. Some examples include using a container for generating database backups, processing log files, etc.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;To run a one-off command which requires network-isolation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sometimes it might be required to just perform computations and print logs in a secure, network-isolated environment. Examples include running ci/cd jobs that export produced artifact files or testing suspicious scripts that could contain malware, etc.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;According to the documentation, &lt;code&gt;none&lt;/code&gt; may also be used in conjunction with a custom network driver.&lt;/p&gt;

&lt;p&gt;Do you know of any other important use cases that I am missing? Please let me know as I’d love to add them here.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this blog, we learnt about the &lt;code&gt;none&lt;/code&gt; network driver in docker - what it is, how to use it, and some possible use cases.&lt;/p&gt;

&lt;p&gt;By enabling network isolation, the &lt;code&gt;none&lt;/code&gt; driver offers a secure environment for running processes. But it also limits its usability.&lt;/p&gt;

&lt;p&gt;In the next blog, we will learn about the &lt;code&gt;host&lt;/code&gt; driver - which provides the best network performance out of all 4 drivers! ⚡️&lt;/p&gt;

&lt;p&gt;Thanks for making it so far! 👏&lt;/p&gt;

&lt;p&gt;See you at the next one.&lt;/p&gt;

&lt;p&gt;Till then…&lt;/p&gt;

&lt;p&gt;Be bold and keep learning.&lt;/p&gt;

&lt;p&gt;But most importantly,&lt;/p&gt;

&lt;p&gt;Tech care!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>containers</category>
      <category>networking</category>
      <category>devops</category>
    </item>
    <item>
      <title>Docker Network Drivers Overview | Networking in Docker #3</title>
      <dc:creator>Farhim Ferdous</dc:creator>
      <pubDate>Mon, 10 Jan 2022 10:36:11 +0000</pubDate>
      <link>https://dev.to/alubhorta/docker-network-drivers-overview-30c</link>
      <guid>https://dev.to/alubhorta/docker-network-drivers-overview-30c</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Learn how Docker Network Drivers allow easy Container network configuration by implementing the Container Network Model&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Link to video: &lt;a href="https://www.youtube.com/watch?v=vmgSIBzYoiE"&gt;https://www.youtube.com/watch?v=vmgSIBzYoiE&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;What are Network Drivers in Docker? How do they enable easy network configuration for Containers?&lt;/p&gt;

&lt;p&gt;This blog will try to answer that as simply as possible.&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;This blog is the third one in a series for Docker Networking.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-1-why-is-networking-important/"&gt;blog #1 - &lt;strong&gt;Why is Networking important in Docker?&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.techmormo.com/posts/docker-networking-2-basics-of-networking/"&gt;blog #2 - &lt;strong&gt;Basics of Networking&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are looking to learn more about the basics of Docker, I’ll recommended checking out the &lt;a href="https://www.techmormo.com/posts/docker-made-easy-1-what-is-docker/"&gt;Docker Made Easy&lt;/a&gt; series.&lt;/p&gt;

&lt;p&gt;Here’s what we will discuss today:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Container Network Model&lt;/li&gt;
&lt;li&gt;Network Drivers: &lt;code&gt;none&lt;/code&gt;, &lt;code&gt;host&lt;/code&gt;, &lt;code&gt;bridge&lt;/code&gt; &amp;amp; &lt;code&gt;overlay&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Okay.&lt;/p&gt;

&lt;p&gt;Firstly, it’s good to know that networking in Docker is made possible by the...&lt;/p&gt;

&lt;h1&gt;
  
  
  Container Network Model
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The Container Network Model&lt;/strong&gt; (CNM) formalizes the steps required to provide networking for containers while providing an abstraction that can be used to support various types of networks.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bnUyb7D0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h2x6aalcg1owf1ihqy5k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bnUyb7D0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h2x6aalcg1owf1ihqy5k.png" alt="CNM" width="880" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CNM has 3 main components: Sandbox, Endpoint, and Network.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Sandbox&lt;/strong&gt;: It contains the configuration of a container's network stack, which means management of the container's network interfaces, DNS settings, route tables, etc. A Sandbox may contain &lt;em&gt;many&lt;/em&gt; endpoints from &lt;em&gt;multiple&lt;/em&gt; Networks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Endpoint&lt;/strong&gt;: It joins a Sandbox to a Network. An Endpoint can belong to only one Network and it can belong to only one Sandbox if connected.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network&lt;/strong&gt;: It is formed by a group of Endpoints that are able to communicate with each other directly.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can think of the Container Network Model as an abstract class that defines the required interface, whereas &lt;em&gt;network drivers&lt;/em&gt; correspond to concrete classes implementing the interface.&lt;/p&gt;

&lt;p&gt;This is, of course, an oversimplification so feel free to learn more about the design of CNM &lt;a href="https://github.com/moby/libnetwork/blob/master/docs/design.md"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As users of Docker, instead of the detailed implementations of CNM, we should learn more about how to properly use...&lt;/p&gt;

&lt;h1&gt;
  
  
  Network drivers
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Network drivers are pluggable interfaces that provide the actual network implementations for Docker Containers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Docker comes with several drivers out-of-the-box that provide core networking functionality for many use cases - like service discovery, encryption, multi-host networking, etc.&lt;/p&gt;

&lt;p&gt;Then there are 3rd party drivers (by plugin providers) available for special use cases.&lt;/p&gt;

&lt;p&gt;Lastly, one can even build their own custom drivers if available ones don't suffice (although that will rarely ever be required).&lt;/p&gt;

&lt;p&gt;The 4 out-of-the-box network drivers are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;none&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;host&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bridge&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;overlay&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The driver can be specified by the &lt;code&gt;--network&lt;/code&gt; option for the &lt;code&gt;docker run&lt;/code&gt; command like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--network&lt;/span&gt; host nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command runs a &lt;code&gt;nignx&lt;/code&gt; container using the &lt;code&gt;host&lt;/code&gt; driver in the background (specified by the &lt;code&gt;-d&lt;/code&gt; flag).&lt;/p&gt;

&lt;p&gt;It’s interesting to note that a Container is generally unaware of the network driver it uses, except when using the &lt;code&gt;none&lt;/code&gt; driver.&lt;/p&gt;

&lt;p&gt;So, how do each of the drivers differ?&lt;/p&gt;

&lt;p&gt;Reminder: a &lt;strong&gt;Docker host&lt;/strong&gt; is a host/computer running the Docker daemon. You can learn more about Docker’s architecture &lt;a href="https://techmormo.com/posts/docker-made-easy-1-what-is-docker/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  None Driver
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;none&lt;/code&gt; driver simply disables networking for a container, making it isolated from other containers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l4OvV3H6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/21rzn2e4pmi995mobx4b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l4OvV3H6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/21rzn2e4pmi995mobx4b.png" alt="driver none" width="880" height="951"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Host Driver
&lt;/h2&gt;

&lt;p&gt;When using the &lt;code&gt;host&lt;/code&gt; driver, the container shares the network stack of the Docker host - appearing as if the container is the host itself, from a networking perspective.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zG8siLpq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qk9z9nvlisw8cc7a05mc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zG8siLpq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qk9z9nvlisw8cc7a05mc.png" alt="driver host" width="880" height="852"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;NOTE: the &lt;code&gt;host&lt;/code&gt; driver is only supported on Linux as of now.&lt;/p&gt;




&lt;h2&gt;
  
  
  Bridge driver
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;bridge&lt;/code&gt; driver creates an internal network within a single Docker host. containers placed within this network can communicate with each other but are isolated from containers, not on the internal network. &lt;code&gt;bridge&lt;/code&gt; is the default driver when running single containers or when using docker-compose.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--z9n71zJd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xq8i8ctvd77zh5l79c6g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z9n71zJd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xq8i8ctvd77zh5l79c6g.png" alt="driver bridge" width="880" height="618"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Overlay driver
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;overlay&lt;/code&gt; driver creates a distributed network that can span multiple Docker hosts, and therefore is the preferred driver for managing container communication within a multi-host cluster. &lt;code&gt;overlay&lt;/code&gt; is the default driver for Docker swarm services.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Yro1uR8y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4vn4ivzabywvekl0tqm1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Yro1uR8y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4vn4ivzabywvekl0tqm1.png" alt="driver overlay" width="880" height="531"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Alright.&lt;/p&gt;

&lt;p&gt;Today we briefly learnt about the Container Network Model and the main Network Drivers that Docker provides.&lt;/p&gt;

&lt;p&gt;In the upcoming blogs of this series, we will explore each of the Drivers in more detail.&lt;/p&gt;

&lt;p&gt;Being pluggable makes drivers highly extensible &amp;amp; portable. As a result, they allow the use of various types of networks, and connect containers amongst themselves and with non-Docker workloads as needed.&lt;/p&gt;

&lt;p&gt;I honestly find great joy when my fellow Engineers/Developers use Container technology effectively to build awesome things!&lt;/p&gt;

&lt;p&gt;Thanks for making it so far! 🎉&lt;/p&gt;

&lt;p&gt;See you at the next one.&lt;/p&gt;

&lt;p&gt;Till then…&lt;/p&gt;

&lt;p&gt;Be bold and keep learning.&lt;/p&gt;

&lt;p&gt;But most importantly,&lt;/p&gt;

&lt;p&gt;Tech care!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>containers</category>
      <category>networking</category>
      <category>devops</category>
    </item>
    <item>
      <title>Basics of Networking | Networking in Docker #2</title>
      <dc:creator>Farhim Ferdous</dc:creator>
      <pubDate>Wed, 08 Dec 2021 15:51:01 +0000</pubDate>
      <link>https://dev.to/alubhorta/basics-of-networking-networking-in-docker-2-2jl9</link>
      <guid>https://dev.to/alubhorta/basics-of-networking-networking-in-docker-2-2jl9</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Understand the core IP network concepts useful for container networking&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Link to video: &lt;a href="https://www.youtube.com/watch?v=BnAozPAMXnc" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=BnAozPAMXnc&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;What is an IP address or a network port? How do they relate to a network interface? 🤔&lt;/p&gt;

&lt;p&gt;If you've ever struggled with networking concepts, this blog is for you.&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;The purpose of this blog is to go over some basic networking topics, which will be specially useful to master networking for Docker containers.&lt;/p&gt;

&lt;p&gt;If you're confident with your networking know-how, you can skip this blog and go directly to the next one.&lt;/p&gt;

&lt;p&gt;But if you have no or very limited networking knowledge, or want to revise the core concepts, read on!&lt;/p&gt;

&lt;p&gt;Here's what we will discuss:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Network Interfaces,&lt;/li&gt;
&lt;li&gt;Internet Protocol (IP),&lt;/li&gt;
&lt;li&gt;Public vs Private networks,&lt;/li&gt;
&lt;li&gt;IP addressing,&lt;/li&gt;
&lt;li&gt;Subnet mask and CIDR,&lt;/li&gt;
&lt;li&gt;Network Ports,&lt;/li&gt;
&lt;li&gt;DNS&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NOTE: We will refer to computers/devices in a network as hosts.&lt;/p&gt;

&lt;p&gt;To recap from &lt;a href="https://www.techmormo.com/posts/docker-networking-1-why-is-networking-important/" rel="noopener noreferrer"&gt;part 1&lt;/a&gt;...&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A network is formed when a group of devices is connected over a medium to share data.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But how do hosts connect to a network?&lt;/p&gt;

&lt;h1&gt;
  
  
  Network Interfaces
&lt;/h1&gt;

&lt;p&gt;A &lt;em&gt;network interface&lt;/em&gt; is the point of interconnection between a host and a network.&lt;/p&gt;

&lt;p&gt;It can either be physical (like the &lt;a href="https://en.wikipedia.org/wiki/Network_interface_controller" rel="noopener noreferrer"&gt;one&lt;/a&gt; below) or virtual (emulated using software).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frc7o64tfntnvi8ztf7aw.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frc7o64tfntnvi8ztf7aw.jpg" alt="network-interface-card by Michael Schwarzenberger from pixabay"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;A local network (e.g. &lt;a href="https://en.wikipedia.org/wiki/Local_area_network" rel="noopener noreferrer"&gt;LAN&lt;/a&gt;) can be formed merely by connecting multiple hosts together (generally by using hardware devices like switches or hubs).&lt;/p&gt;

&lt;p&gt;This eventually results in many local networks where communication between hosts is possible but only within that local network.&lt;/p&gt;

&lt;p&gt;But how would one transmit data across networks?&lt;/p&gt;

&lt;h1&gt;
  
  
  Internet Protocol (IP)
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;IP (or &lt;a href="https://en.wikipedia.org/wiki/Internet_Protocol" rel="noopener noreferrer"&gt;Internet protocol&lt;/a&gt;) is a standard protocol for transmitting packets of data between hosts across networks, connected to form an IP network.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A host can send data to another one by specifying the destination host's IP address on the data packet. The packet of data can then be routed to the correct host via one or more routers.&lt;/p&gt;

&lt;p&gt;A router is a special-purpose device with two or more network interfaces, connecting two or more networks, which allows it to forward data packets from one network to another.&lt;/p&gt;

&lt;p&gt;Thus, IP allows us to form a network of networks i.e. internetwork.&lt;/p&gt;

&lt;h2&gt;
  
  
  Public vs private networks
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6mmkjwvqd8krh6p3jdo6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6mmkjwvqd8krh6p3jdo6.png" alt="public-vs-private-network-representation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A network is said to be &lt;em&gt;public&lt;/em&gt; if anyone can access it from outside. The Internet is the best and probably the only pure example of such a network.&lt;/p&gt;

&lt;p&gt;A &lt;em&gt;private network&lt;/em&gt; is one to which access is restricted. Local networks like those in a company or school are examples of private networks.&lt;/p&gt;

&lt;p&gt;Private networks offer security by not exposing hosts directly to the Internet.&lt;/p&gt;

&lt;h2&gt;
  
  
  IP addresses
&lt;/h2&gt;

&lt;p&gt;Each host in an IP network can have one or more IP addresses, depending on how many network interfaces it has.&lt;/p&gt;

&lt;p&gt;An IP Address is a numeric expression for identifying a particular host on a particular network.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;10.2.0.10&lt;/code&gt; is an example of an IP address.&lt;/p&gt;

&lt;p&gt;32 bits are used to represent the address, so both addresses below are equivalent - the top one being decimal while the bottom one is binary.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   10   &lt;span class="nb"&gt;.&lt;/span&gt;   2    &lt;span class="nb"&gt;.&lt;/span&gt;   0    &lt;span class="nb"&gt;.&lt;/span&gt;  10
00001010.00000010.00000000.00001010
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since 8 bits are used to create each of the four-dot (&lt;code&gt;.&lt;/code&gt;) separated segments, the value of each segment can range from 0 to 255.&lt;/p&gt;

&lt;h2&gt;
  
  
  Subnets masks &amp;amp; CIDR
&lt;/h2&gt;

&lt;p&gt;Since an IP network can span multiple smaller networks (subnets), there needs to be a way to specify the network a host belongs to in order to route data packets to it.&lt;/p&gt;

&lt;p&gt;The IP address of a host is often specified as &lt;code&gt;10.2.0.10/24&lt;/code&gt;, where &lt;code&gt;/24&lt;/code&gt; specifies the part of the address that belongs to the subnet i.e. the subnet mask. This is also called the &lt;a href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing" rel="noopener noreferrer"&gt;CIDR notation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For example, the IP &lt;code&gt;10.2.0.10/24&lt;/code&gt; uses the first 24 bits to identify the network, whereas the rest of the 8 bits are used to identify hosts within that network. This allows 2^8 or 256 different IP addresses (practically fewer as some IPs are reserved).&lt;/p&gt;

&lt;p&gt;The following shows the minimum and maximum IP address values for this subnet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;min: 00001010.00000010.00000000.00000000
max: 00001010.00000010.00000000.11111111
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Therefore, the larger the subnet mask (i.e. the bigger the number after &lt;code&gt;/&lt;/code&gt;), the fewer the hosts that subnet can accommodate.&lt;/p&gt;




&lt;p&gt;Okay, we now know how data is transmitted to the correct network and host using IP.&lt;/p&gt;

&lt;p&gt;But a host could be running many different applications. How can one host reach a particular application on a destination host?&lt;/p&gt;

&lt;h1&gt;
  
  
  Network Ports
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;A &lt;strong&gt;network port&lt;/strong&gt; is a logical endpoint for specifying the correct host application/process being communicated with.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A port is &lt;em&gt;identified for each &lt;a href="https://en.wikipedia.org/wiki/Transport_layer" rel="noopener noreferrer"&gt;Transport Layer&lt;/a&gt; protocol and IP address combination by a 16-bit unsigned number.&lt;/em&gt; The two most prominent Transport Layer protocols are &lt;a href="https://en.wikipedia.org/wiki/User_Datagram_Protocol" rel="noopener noreferrer"&gt;User Datagram Protocol&lt;/a&gt; (UDP) and &lt;a href="https://en.wikipedia.org/wiki/Transmission_Control_Protocol" rel="noopener noreferrer"&gt;Transmission Control Protocol&lt;/a&gt; (TCP).&lt;/p&gt;

&lt;p&gt;This means, for a host with a given IP address, there can be up to 65535 ports available for TCP and UDP each. Each application (or networked service) running on the host could then use zero or more of the ports that are available.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhx3fbkjgumz8var1rklk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhx3fbkjgumz8var1rklk.png" alt="analogy-of-ports"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Port numbers from 0 to 1023 are called well-known or system ports and are reserved for standard networked services, like TCP port 80 for HTTP, TCP port 443 HTTPS, etc.&lt;/p&gt;




&lt;p&gt;Just one more networking concept to remember...&lt;/p&gt;

&lt;h1&gt;
  
  
  Domain name system
&lt;/h1&gt;

&lt;p&gt;The &lt;a href="https://en.wikipedia.org/wiki/Domain_Name_System" rel="noopener noreferrer"&gt;Domain name system&lt;/a&gt; (DNS) was invented to translate domain names to IP addresses (and vice versa), as it is difficult for us humans to remember IP addresses.&lt;/p&gt;

&lt;p&gt;At the simplest level, DNS records are domain name to IP address mappings, like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;google.com    172.217.194.100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Records like these (and more complex ones) are distributed across multiple levels of &lt;em&gt;name servers&lt;/em&gt;, which serve to provide this domain name to IP address translation.&lt;/p&gt;

&lt;p&gt;Your host machine keeps a local cache of recently queried DNS records and asks name servers when it doesn't find the requested domain record locally.&lt;/p&gt;

&lt;p&gt;You can check the IP addresses for &lt;code&gt;google.com&lt;/code&gt; by typing this in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nslookup google.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;In this blog, we briefly discussed - network interfaces, the Internet Protocol, public vs private networks, IP addresses, subnets, network ports, and DNS.&lt;/p&gt;

&lt;p&gt;If we keep these concepts in mind, Docker container networking will be much easier to understand and apply.&lt;/p&gt;

&lt;p&gt;Thanks for making it so far! 🎉&lt;/p&gt;

&lt;p&gt;See you on the next one.&lt;/p&gt;

&lt;p&gt;Till then…&lt;/p&gt;

&lt;p&gt;Be bold and keep learning.&lt;/p&gt;

&lt;p&gt;But most importantly,&lt;/p&gt;

&lt;p&gt;Tech care!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>networking</category>
      <category>devops</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Why is Networking important in Docker? | Networking in Docker #1</title>
      <dc:creator>Farhim Ferdous</dc:creator>
      <pubDate>Tue, 02 Nov 2021 10:46:23 +0000</pubDate>
      <link>https://dev.to/alubhorta/why-is-networking-important-in-docker-networking-in-docker-1-3mef</link>
      <guid>https://dev.to/alubhorta/why-is-networking-important-in-docker-networking-in-docker-1-3mef</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Introduce the need for learning about Docker Networking and an overview of this series&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Link to video: &lt;a href="https://www.youtube.com/watch?v=9VNI0r4k0jo"&gt;https://www.youtube.com/watch?v=9VNI0r4k0jo&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Docker enables massive innovation in today's fast-paced IT industry.&lt;/p&gt;

&lt;p&gt;And a lot of this is made possible by connecting multiple containers together. 🔌&lt;/p&gt;

&lt;p&gt;If you, as an Engineer or Developer, ignore the networking part of Docker, you will miss out on arguably one of its most powerful capabilities.&lt;/p&gt;

&lt;p&gt;But, before we understand "WHY" it's important, let's first answer...&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a network?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;A network is formed when a group of devices is connected over a medium to share data.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The devices (or computer systems) would be connected to the network by some form of physical or virtual interface. &lt;/p&gt;

&lt;p&gt;The medium could be wired or wireless, be it cables, telephone lines or radio waves, etc. &lt;/p&gt;

&lt;p&gt;But the main purpose remains to connect multiple systems together for some form of data sharing.&lt;/p&gt;

&lt;p&gt;So...&lt;/p&gt;

&lt;h2&gt;
  
  
  Why is networking important in Docker?
&lt;/h2&gt;

&lt;p&gt;A Container, being a form of &lt;a href="https://techmormo.com/posts/what-is-virtualization/"&gt;virtualization&lt;/a&gt;, acts as an isolated system from the Docker host and from other containers. &lt;/p&gt;

&lt;p&gt;Oftentimes, &lt;em&gt;we need to connect multiple containers to produce a useful outcome&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;This is the answer to our "WHY".&lt;/p&gt;

&lt;p&gt;Let's look at an example to make this clear...&lt;/p&gt;

&lt;p&gt;Suppose we have a web application that requires a database. So we create two containers named &lt;code&gt;web&lt;/code&gt; and &lt;code&gt;db&lt;/code&gt; respectively.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xp8hHozP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mchyvqnsgtwdx9r44pp8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xp8hHozP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mchyvqnsgtwdx9r44pp8.png" alt="disconnected containers" width="880" height="256"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The web application could be for example Django and its database could be MySQL, or whatever framework/library and database you prefer, that's not our concern.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The important thing is that, &lt;code&gt;web&lt;/code&gt; needs to connect to &lt;code&gt;db&lt;/code&gt; for storing, modifying, and retrieving data.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The database, in turn, would preferably use Docker Volumes to persist that data, since the data in a container is not persistent by default (learn more about Volumes and persistence in Docker &lt;a href="https://techmormo.com/posts/docker-made-easy-4-persistence-and-docker-volumes/"&gt;here&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;But, how would we achieve a connection between the two containers? 🤔&lt;/p&gt;

&lt;p&gt;If both containers were connected to an IP network, they would each have a unique IP address on that network.&lt;/p&gt;

&lt;p&gt;Let's say &lt;code&gt;web&lt;/code&gt; is at IP &lt;code&gt;10.0.0.2&lt;/code&gt;, and &lt;code&gt;db&lt;/code&gt; is at IP &lt;code&gt;10.0.0.3&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZFyHE4sz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jfbcrymfl25s17ax05ul.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZFyHE4sz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jfbcrymfl25s17ax05ul.png" alt="connected containers" width="880" height="256"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;web&lt;/code&gt; could then connect to &lt;code&gt;db&lt;/code&gt; using the IP &lt;code&gt;10.0.0.3&lt;/code&gt; and we would live happily ever after! 🏝&lt;/p&gt;

&lt;p&gt;Cool.&lt;/p&gt;

&lt;p&gt;But how do we actually create this network in the first place?&lt;/p&gt;

&lt;p&gt;Also, if we wanted to reach our web application from the host or from the Internet, how'd we do that?&lt;/p&gt;

&lt;p&gt;The problems seem simple enough but implementing a solution doesn't sound like so.&lt;/p&gt;

&lt;p&gt;Welcome to the complexity so common in networking. 🕸&lt;/p&gt;

&lt;p&gt;Wait! ✋&lt;/p&gt;

&lt;p&gt;Before you run away from this complexity, there's good news. 🏃‍♂️💨&lt;/p&gt;

&lt;p&gt;There is no complexity for us to manage because Docker handles the network complexity for us! In fact, that is one of the primary advantages of using Docker.&lt;/p&gt;

&lt;p&gt;Yay!!! 🙌&lt;/p&gt;

&lt;p&gt;As users of Docker, we just need to know about the main &lt;strong&gt;network drivers&lt;/strong&gt;, which are high-level interfaces that abstract away the network implementations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ikyjaOza--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sunvoep24fywg727csi5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ikyjaOza--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sunvoep24fywg727csi5.png" alt="driver-analogy" width="880" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Don't worry if that doesn't make sense yet, we'll be learning more about them in the upcoming sections of this series.&lt;/p&gt;

&lt;p&gt;Here's the...&lt;/p&gt;

&lt;h3&gt;
  
  
  Structure of this series - Networking in Docker
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;(current) Why is Networking important in Docker?&lt;/li&gt;
&lt;li&gt;The Basics of Networking &lt;/li&gt;
&lt;li&gt;Container Network Model &amp;amp; Drivers Overview&lt;/li&gt;
&lt;li&gt;Network driver: &lt;code&gt;none&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Network driver: &lt;code&gt;host&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Network driver: &lt;code&gt;bridge&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Network driver: &lt;code&gt;overlay&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Summary, Differences &amp;amp; What's next?&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this short introduction, we briefly discussed what a network is and why it's important in Docker.&lt;/p&gt;

&lt;p&gt;We also looked at the structure of this series - Networking in Docker.&lt;/p&gt;

&lt;p&gt;Knowing about the basics of networking can definitely help, not just with Docker but as an Engineer/Developer in general because so much of our work is made possible by the Internet, which is a network itself!&lt;/p&gt;

&lt;p&gt;So, that's what we will learn in the next part - The Basics of Networking.&lt;/p&gt;

&lt;p&gt;I'm super excited about this series because I myself am also learning a lot about networking from it! See you on the next one. 👋&lt;/p&gt;

&lt;p&gt;Till then...&lt;/p&gt;

&lt;p&gt;Be bold and keep learning.&lt;/p&gt;

&lt;p&gt;But most importantly,&lt;/p&gt;

&lt;p&gt;Tech care!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>containers</category>
      <category>network</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
