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

Port Mapping and Exposing Services — -p vs EXPOSE

Reviewed & accurate
AI Summary

What You'll Learn

Beginner

  • The difference between EXPOSE and -p
  • How to publish ports correctly
The #1 confusion
EXPOSE is documentation only. -p actually publishes the port.
EXPOSE (Dockerfile)-p (docker run)
Documentation onlyActually publishes
EXPOSE 3000-p 3000:3000

Key Takeaways

  • EXPOSE is documentation — does NOT publish ports.
  • -p host:container actually maps ports.
  • Don't publish database ports unless needed.
  • On custom networks, containers communicate directly.
Previously: Lesson 29 covered communication.
Today: You learned: The difference between EXPOSE and -p.
Next: Lesson 31 covers custom networks.
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