Docker Compose Networking#
Dokploy automatically transforms Docker Compose files at deploy time to inject networks that wire services together and connect them to the Traefik reverse proxy. There are two distinct networking modes, controlled by the isolatedDeployment flag on the compose schema .
Two Networking Modes#
1. Shared Mode (default: isolatedDeployment = false)#
Every service that has a domain configured receives two injected networks:
dokploy-network(external) — the shared network Traefik listens on. Injected viaaddDokployNetworkToService()andaddDokployNetworkToRoot()inpackages/server/src/utils/docker/domain.ts.default— Docker Compose's implicit project-scoped bridge network, injected to preserve connectivity between services that rely on it.
Both are added unconditionally by the current implementation inside addDomainToCompose() .
2. Isolated Mode (isolatedDeployment = true)#
A unique bridge (or Swarm overlay for stack deployments) network named after the app is created per deployment :
docker network inspect <appName> || docker network create [--driver overlay] --attachable <appName>
docker network connect <appName> $(docker ps --filter "name=dokploy-traefik" -q)
The app-name network is injected into the Compose file via addAppNameToRootNetwork() and addAppNameToServiceNetworks() in packages/server/src/utils/docker/collision/root-network.ts. Traefik is then connected to that network, so routing still works.
Network Suffix Collision Prevention#
When multiple Compose apps share the same network names, Dokploy applies a suffix (e.g. frontend-abc123) to avoid collisions. The logic lives in packages/server/src/utils/docker/compose/network.ts:
| Function | What it does |
|---|---|
addSuffixToNetworksRoot() | Renames root-level networks with a suffix |
addSuffixToServiceNetworks() | Renames network refs inside each service |
addSuffixToAllNetworks() | Orchestrates the above two |
dokploy-network is always excluded from suffixing so that Traefik's shared network is never renamed.
Address Pool Exhaustion — Root Cause & Status#
The problem: Issue #4499 and Issue #4759 document a production failure where Dokploy exhausts Docker's predefined IPv4 address pools:
Error response from daemon: all predefined address pools have been fully subnetted
Root cause: PR #3614 (merged 2026-02-07) made addDokployNetworkToService() unconditionally inject the "default" network onto every service, even those that already declared explicit networks . Each such service causes Docker Compose to create a new <project>_default bridge network on every deploy. On a host with many deployments, Docker's pool of ~30 default /24 subnets is exhausted.
Pending fix: PR #4592 (open as of 2026-07-07) adds a guard: default is only injected when the service had no networks key at all (the undefined case, i.e. it was relying on the implicit Docker Compose default network) . Services with an explicit networks key — even an empty one — do not get default injected, avoiding the unnecessary bridge network creation.
Workarounds (Until PR #4592 Merges)#
-
Expand Docker's address pool — add to
/etc/docker/daemon.json:{ "default-address-pools": [ { "base": "172.16.0.0/12", "size": 24 } ] }Restart Docker after applying.
-
Prune unused networks —
docker network pruneremoves all unused bridge networks and reclaims subnets . -
Declare explicit networks in your Compose file — services that define a
networks:key (even if it only listsdokploy-network) are not affected by the pool exhaustion bug . -
Use
isolatedDeployment = true— creates a single named network per app rather than a default bridge per deployment.
Related Issues#
| Issue | Summary |
|---|---|
| #4499 | Address pool exhaustion from unconditional default injection |
| #4759 | Deployment failures post-v0.29.10 due to pool exhaustion |
| #4057 | Traefik fails to start after reboot (stale overlay network IP conflict in Swarm) |
| #4124 | --swarm-args ignored; use DOCKER_SWARM_INIT_ARGS env var to pass custom address pools to docker swarm init |
Key Source Files#
| File | Purpose |
|---|---|
packages/server/src/utils/docker/domain.ts | addDokployNetworkToService, addDokployNetworkToRoot — shared network injection |
packages/server/src/utils/docker/compose/network.ts | addSuffixToAllNetworks and related — collision-prevention suffixing |
packages/server/src/utils/docker/collision/root-network.ts | addAppNameToRootNetwork — isolated deployment network injection |
packages/server/src/utils/builders/compose.ts | getBuildComposeCommand — orchestrates compose build, isolated network creation, Traefik connection |
packages/server/src/db/schema/compose.ts | Compose schema: isolatedDeployment, randomize, suffix flags |
apps/dokploy/__test__/compose/network/ | Unit tests for suffix and root network transforms |