Sitemap

Docker Network Made Simple: The Secret Behind Container Communication

3 min readJul 26, 2026

--

When we use Docker and work with multiple containers, we often encounter Docker networks. But what exactly are they? OK, let’s get straight to the explanation in very simple way!

1. Definition

The key concept is a Docker network is like a private room that allows containers inside to communicate each other, while staying isolate from other container outside that room.

When containers are in the same network, they can communicate to each other by using their alias name. Each alias points to the container’s IP address, so we don’t need to remember or use the actual IP address from that container itself (example: 172.18.0.3), just using their alias inside their network to communicate. You can see an example of the alias below.

2. Inspect the Docker Network

Now we will take a look at the example to understand it deeper. In this case, I have three docker containers:

Press enter or click to view image in full size

These containers are from one of my previous VPS projects. This project uses a framework called Airflow. In very simple term, Airflow is a framework that is used to manage and schedule data pipeline. However we won’t discuss Airflow in detail here, instead, we’ll see how the webserver and scheduler containers communicate with the PostgreSQL database, named airflow-postgres-1.

First we will inspect the docker container named airflow-airflow-scheduler-1 using the container id (you can look at the id at the docker ps result above) to see which network the container is connected to. We get one line that shows network name of that container.

Now we will inspect the network using command below to see all the containers inside that network.

And we will get all of the containers inside that network, this matches with the definition we discuss earlier that the network itself is a private room for containers.

Press enter or click to view image in full size

It means that the containers can communicate each other easily. However, which containers are communicating with each other?

Get Surya Panji Musthofa’s stories in your inbox

Join Medium for free to get updates from this writer.

OK, we can look at the inspect result again for it. Based on the first inspect result earlier, from container named airflow-airflow-scheduler-1 (sorry about the long name), we also get this result.

Press enter or click to view image in full size

Yeyy, we found that the scheduler depends on postgres (an alias for database container’s IP address). This means that the scheduler container will connect to postgres container. The webserver container works the same way. Below is the result from inspecting webserver container.

Press enter or click to view image in full size

So, based on the our findings above, we know that scheduler and webserver container communicate with the database using network named airflow_default. Their communication is used to store pipeline metadata in the postgreSQL database.

--

--