Pcornel
Linux · Containers

Networks

Cheat sheet · https://pcornel.dk/topic.php?topic=2894

Back to the Topic

Answer

Container networks connect containers: the default bridge (NAT to the host), user-defined bridges with DNS between containers, host networking and macvlan/overlay networks.

Remember

Use user-defined networks so containers resolve each other by name. Published ports (-p host:container) go through NAT on the host. Check the app listens on 0.0.0.0 inside the container, not 127.0.0.1.

First checks

  • docker ps -a / podman ps -a — containers and state
  • docker logs <c> — container output
  • docker inspect <c> — configuration, mounts, network
  • docker info — engine, storage driver, cgroup version

Commands

docker network create --internal

Verify in this order

container attached to a network → IP and DNS → bridge/NAT → published port → client

Where it usually breaks

First mismatch in hardware/kernel capability → scheduler/mm/device → cgroup/namespace → process/thread → service/runtime → workload behavior/counters; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2894

Confirmation

Confirm action

Continue?