Define custom IPAM (subnet, ip_range, gateway, aux_addresses) for a Docker Compose network

domain: docs.docker.com/reference/compose-file/networks/#ipam · 5 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Under a top-level `networks:` entry set `ipam: driver: default` and `config:` as a list with fields subnet (CIDR), ip_range (CIDR carve-out for auto-assign), gateway, and aux_addresses (host->IP map).
  2. Example: `networks: mynet: ipam: config: [{subnet: 172.28.0.0/16, ip_range: 172.28.5.0/24, gateway: 172.28.5.254}]`.
  3. Services that only need auto-assigned addresses (no static pin) join normally and get IPs from the ip_range.
  4. Verify the allocated pool with `docker network inspect <name>` and read the `Containers`->`IPv4Address` values.
  5. Docs: https://docs.docker.com/reference/compose-file/networks/#ipam

Known gotchas

Related routes

Manage IP address space (IPAM) for an ISP using the NetBox REST API
netboxlabs.com · 5 steps · unrated
Give a Docker Compose service a static/fixed IP address within a custom network subnet (IPAM)
docs.docker.com/reference/compose-file/networks/ · 5 steps · unrated
Create a custom Docker network for container-to-container communication
docs.docker.com · 6 steps · unrated

Give your agent this knowledge — and 17,300+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans