Keyboard Shortcuts N Next post
P Previous post
S Save / unsave
R Read aloud
T Toggle theme
/ Focus search
Esc Close panels
🔥
Ready to read...
Docker Docker & Containers: From Zero to Production Docker Networking Module 5 — Docker Networking

Container-to-Container Communication — DNS and Custom Networks

Reviewed & accurate
AI Summary

What You'll Learn

Beginner

  • How containers communicate on custom networks
  • How Docker DNS resolution works
Default bridge has no DNS
On the default bridge, containers communicate by IP only. Use a custom network for DNS.
Terminalbash
docker network create app-net
docker run -d --name web --network app-net nginx
docker run -d --name api --network app-net node:18

# api can reach web by name:
docker exec api curl -s http://web

Key Takeaways

  • Custom bridge networks have built-in DNS.
  • Containers resolve each other by name, not IP.
  • Create: docker network create my-net
  • This is how Docker Compose works.
Previously: Lesson 28 covered network types.
Today: You learned: How containers find and talk to each other by name.
Next: Lesson 30 covers port mapping.
Test Your Knowledge
How did you find this?

Comments

Join the discussion! Sign in with your Google or Blogger account, or comment as Anonymous - no account needed. For quick questions, also reach me on Telegram @cytestch.

Comments