✦ For everyone, free.

Practical knowledge for real and everyday life

Home

9.4.1.2 Up Network Creation

A focused guide to Up Network Creation, connecting core concepts with practical Docker and container operations.

Up network creation is the part of docker compose up's overall behavior responsible for automatically creating whatever networks an application's services need — the default network if none are explicitly declared, or any custom networks the Compose file does declare — before the services themselves are started.

Automatic Default Network Creation

Without any explicit network declaration, Compose creates a single default network as part of bringing the application up for the first time.

services:
  api:
    build: .
  db:
    image: postgres:16
docker compose up -d
docker network ls
myapp_default

This network was created automatically as part of this up invocation, with both services attached to it.

Creating Explicitly Declared Networks

When a Compose file declares its own custom networks, up creates each of these as well, before the dependent services start.

networks:
  frontend-net:
  backend-net:

Both networks are created (if they don't already exist) as part of bringing this application up.

Why Networks Aren't Recreated on Every Up

Once created, an existing network used by a Compose application is typically reused on subsequent up invocations, rather than being recreated each time, as long as its configuration hasn't changed.

docker compose up -d
docker compose up -d

The second invocation reuses the already-existing network rather than recreating it.

Verifying Network Creation Succeeded

Confirming the expected networks were actually created, with the intended configuration, validates this part of the startup process completed correctly.

docker network inspect myapp_default
Why Up Network Creation Matters

This automatic network setup is a core part of what makes Compose's declarative networking model work in practice, ensuring services can reliably reach each other by name without requiring any manual, separate network creation step.