docker network create: Create User-Defined Networks
Create a user-defined network so containers can find each other by name.
docker network create makes a network containers can join. On a user-defined bridge, containers resolve each other by name. This page covers drivers and CI service wiring.
What it does
docker network create defines a network (bridge by default). Unlike the default bridge, a user-defined bridge provides automatic DNS so containers reach each other by container name, which is essential for multi-container CI tests.
Common usage
docker network create testnet
docker run -d --name db --network testnet postgres:16
docker run --rm --network testnet myapp ./run-tests
docker network create --subnet 172.30.0.0/16 customnetCommon errors in CI
"Pool overlaps with other one on this address space" means the requested subnet collides with an existing network - pick a different range or prune stale networks. On the default bridge, name-based DNS does not work ("could not resolve host: db"); create a user-defined network so service names resolve. GitHub Actions service containers share a network automatically - you usually do not need this there.