DEV Community

Cover image for Why is Networking important in Docker? | Networking in Docker #1
Farhim Ferdous
Farhim Ferdous

Posted on • Updated on

Why is Networking important in Docker? | Networking in Docker #1

Introduce the need for learning about Docker Networking and an overview of this series

Link to video:

Docker enables massive innovation in today's fast-paced IT industry.

And a lot of this is made possible by connecting multiple containers together. 🔌

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.

But, before we understand "WHY" it's important, let's first answer...

What is a network?

A network is formed when a group of devices is connected over a medium to share data.

The devices (or computer systems) would be connected to the network by some form of physical or virtual interface.

The medium could be wired or wireless, be it cables, telephone lines or radio waves, etc.

But the main purpose remains to connect multiple systems together for some form of data sharing.


Why is networking important in Docker?

A Container, being a form of virtualization, acts as an isolated system from the Docker host and from other containers.

Oftentimes, we need to connect multiple containers to produce a useful outcome.

This is the answer to our "WHY".

Let's look at an example to make this clear...

Suppose we have a web application that requires a database. So we create two containers named web and db respectively.

disconnected containers

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.

The important thing is that, web needs to connect to db for storing, modifying, and retrieving data.

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 here).

But, how would we achieve a connection between the two containers? 🤔

If both containers were connected to an IP network, they would each have a unique IP address on that network.

Let's say web is at IP, and db is at IP

connected containers

web could then connect to db using the IP and we would live happily ever after! 🏝


But how do we actually create this network in the first place?

Also, if we wanted to reach our web application from the host or from the Internet, how'd we do that?

The problems seem simple enough but implementing a solution doesn't sound like so.

Welcome to the complexity so common in networking. 🕸

Wait! ✋

Before you run away from this complexity, there's good news. 🏃‍♂️💨

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.

Yay!!! 🙌

As users of Docker, we just need to know about the main network drivers, which are high-level interfaces that abstract away the network implementations.


Don't worry if that doesn't make sense yet, we'll be learning more about them in the upcoming sections of this series.

Here's the...

Structure of this series - Networking in Docker

  1. (current) Why is Networking important in Docker?
  2. The Basics of Networking
  3. Container Network Model & Drivers Overview
  4. Network driver: none
  5. Network driver: host
  6. Network driver: bridge
  7. Network driver: overlay
  8. Summary, Differences & What's next?


In this short introduction, we briefly discussed what a network is and why it's important in Docker.

We also looked at the structure of this series - Networking in Docker.

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!

So, that's what we will learn in the next part - The Basics of Networking.

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. 👋

Till then...

Be bold and keep learning.

But most importantly,

Tech care!

Top comments (0)