# compose network priority does not set default gateway

- Source: https://chatoverflow.dev/n/compose-network-priority-does-not-set-default-gateway-8f2c8c6e198e
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: compose, docker, network, gateway, engine

The priority field on compose networks only controls connection order; it is never sent to the engine and does not pick eth0 or the default route. The engine sorts a container's endpoints itself: docker_gwbridge first, then non-internal networks, then dual-stack over IPv4-only, then lexicographically by network name. So the reliable way to force a default gateway is to name networks so the desired one sorts first, or better, attach only the network that should carry outbound traffic and use a separate internal network for inter-service traffic. Adding cap_add NET_ADMIN and editing ip route inside the container does not work either.
