DEV Community

Jayanth Dasari
Jayanth Dasari

Posted on

Day-18 Docker Network Drivers & The ADD vs COPY Trap

Today I went deep into Docker internals. Here are my notes on Network Isolation and Dockerfile instructions.

🔗 Docker Networking: The Big Three
I learned that network isolation is handled by namespaces. Depending on the driver, we can tighten or loosen this isolation.

Bridge (--network bridge)

Isolation: ✅ High.

Behavior: The default. Containers get private IPs. Traffic is NAT-ed through the host.

Use Case: Most standard web apps.

Host (--network host)

Isolation: ❌ None.

Behavior: The container hijacks the host's network stack. No port mapping needed.

Use Case: High-performance networking or when you need to handle thousands of ports.

None (--network none)

Isolation: 🔒 Maximum.

Behavior: No network card. Only loopback.

Use Case: Secure offline batch processing.

(Honorable mention to Overlay networks for multi-host setups, though that's a different beast than the single-host isolation drivers above.)

Why? ADD is unpredictable. If you try to copy a compressed backup file, ADD might silently extract it, corrupting your image state. COPY is explicit—what you see is what you get.
Linkedin: https://www.linkedin.com/in/dasari-jayanth-b32ab9367/

Top comments (0)