โ† Back to list

๐Ÿณ Day 13: Docker Networking Basics (Containers Talking Like Microservices)

One of the most common beginner mistakes:

Tinesh Krishna ยท 2026-02-02 11:53 ยท 0 claps ยท 1.3 min read
#docker #devops #docker-network #aws
Open on Medium โ†—
Wiki topics: โ˜๏ธ ยท DevOps & Cloud

๐Ÿณ Day 13: Docker Networking Basics (Containers Talking Like Microservices)

One of the most common beginner mistakes:

โ€œMy app canโ€™t connect to the database container.โ€

Letโ€™s understand why and how Docker networking actually works.

๐Ÿง  Why localhost Fails Between Containers

Each container:

  • Has its own network stack
  • Own IP address
  • Own loopback interface

So:

localhost inside container โ‰  host โ‰  other container

๐Ÿ“ก Default Bridge Network

When you run:

docker run nginx

Docker connects the container to the default bridge network.

Problems: โŒ Containers must use IPs โŒ IPs change on restart โŒ Not production-friendly

โœ… User-Defined Bridge Network (BEST PRACTICE)

docker network create app-net
docker run -d --name web --network app-net nginx
docker run -d --name db --network app-net mysql

Now:

web โ†’ db (by name)

Docker provides built-in DNS.

๐ŸŒ Common Docker Network Types

1๏ธโƒฃ bridge

  • Default
  • Local development
  • Most common

2๏ธโƒฃ host

  • Container uses host network
  • No isolation
  • Used for performance testing

3๏ธโƒฃ none

  • No networking
  • Full isolation
  • Security testing

4๏ธโƒฃ overlay

  • Multi-host networking
  • Docker Swarm / legacy

๐Ÿšจ Real Production Incident

A team hardcoded container IPs.

Result:

  • Container restarted
  • IP changed
  • App crashed

Fix: ๐Ÿ‘‰ Used user-defined bridge + container names ๐Ÿ‘‰ Issue resolved permanently

๐ŸŽฏ Beginner Takeaway

Remember this rule:

Containers communicate via networks, not localhost.

If multiple containers exist โ†’ create a network.

๐Ÿ”œ Whatโ€™s Next?

In Day 14, weโ€™ll cover: ๐Ÿณ Docker Compose

  • Running multi-container apps easily
  • Real-world examples
  • Interview questions

๐Ÿ“Œ Follow the Series

This #25DaysOfDocker series focuses on:

  • Real production problems
  • Beginner-friendly explanations
  • Interview-relevant topics
  • Practical DevOps mindset

Day 13 done โ€” you just unlocked microservice networking basics ๐Ÿš€


๋ฉ”ํƒ€๋ฐ์ดํ„ฐ
post_id
25ecf2cc1126
slug
day-13-docker-networking-basics-containers-talking-like-microservices-25ecf2cc1126
url
https://medium.com/@tineshsingarapu003/day-13-docker-networking-basics-containers-talking-like-microservices-25ecf2cc1126
canonical_url
https://medium.com/@tineshsingarapu003/day-13-docker-networking-basics-containers-talking-like-microservices-25ecf2cc1126
author_url
https://medium.com/@tineshsingarapu003
status
ok
fetched_at
2026-06-15 20:49:13