Knowledgebase

Container Networking Basics Print

  • 0

How containers reach each other.

WHAT THE DEFAULT NETWORK PROVIDES

Containers able to reach the outside, and reachable through published ports.

WHAT A USER-DEFINED NETWORK ADDS

Containers reaching each other by name.

WHY THAT MATTERS

Addresses change; names do not.

WHAT THAT REPLACES

Linking containers, an older mechanism now obsolete.

HOW NAME RESOLUTION WORKS

The engine runs a resolver, answering with the container's current address.

WHAT TO USE AS A HOSTNAME

The container or service name.

WHAT PUBLISHING A PORT DOES

Makes it reachable from outside the host.

WHAT NOT PUBLISHING ACHIEVES

The service reachable only by other containers on the same network.

WHY THAT IS THE RIGHT DEFAULT FOR DATABASES

They should not be reachable from outside.

WHAT TO BE CAREFUL WITH

The engine manipulating firewall rules directly.

WHY

A published port may bypass rules you configured.

WHAT TO CHECK

What is actually listening on the host, and on which address.

HOW TO REACH THE HOST FROM INSIDE A CONTAINER

A special hostname the engine provides, which differs by platform.

WHAT TO AVOID

Hard-coding addresses Assuming a container keeps the same address across restarts

WHAT TO PREFER

Names, on a defined network.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot