-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Description
Description
hi i've been reading through all the documentation and i'm struggling on how to define which networks in docker compose become the default gateway
from googling i can find various resources which say that its;
- in the order in which it is defined in the compose file (but this seems not to be true)
- that it is based upon the alphabetic naming of the networks, so A will begin before B etc (this seems to be true for customer docker networks, but it doesn't work similarly when combined with ipvlan networks)
I stumbled across a few different issues here which talked about priority and i thought that i could use that to define which network becomes the default outbound gateway but that doesn't appear to be the case either, i'm not sure what priority does - from reading the bug thread it mentioned it was something in relation to mac addresses.
Steps To Reproduce
networks:
intraNW:
priority: 10
br0:
priority: 30
ipv4_address: 192.168.1.145
a-traefik-public:
priority: 20
take for example this, br0 is an ipvlan network and the other 2 are custom docker networks
my use case scenario is that i want to have as eth0 the br0 interface. the reason for this is because i wish to do split tunnelling on the router and in order to do that i need ipvlan.
it works fine if i remove the other custom networks, but i can't for the life of me seem to be able to get the ipvlan br0 network to become the default eth0 network whilst using docker custom networks alongside it
one possible solution to this seems to be creating a container init script and running that on load, which will change the default route to the desired one but i think this is not a very clean solution compared to a native implementation which docker compose
Compose Version
Docker Compose version v2.29.2
Docker Environment
Client:
Version: 24.0.9
Context: default
Debug Mode: false
Plugins:
compose: Docker Compose (Docker Inc.)
Version: v2.29.2
Path: /usr/local/lib/docker/cli-plugins/docker-compose
Server:
Containers: 79
Running: 50
Paused: 0
Stopped: 29
Images: 209
Server Version: 24.0.9
Storage Driver: btrfs
Btrfs:
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 7c3aca7a610df76212171d200ca3811ff6096eb8
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.1.99-Unraid
Operating System: Slackware 15.0 x86_64 (post 15.0 -current)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 78.56GiB
Name: alexandria
ID: xxx
Docker Root Dir: /var/lib/docker
Debug Mode: false
Username: hvrpride
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
WARNING: No swap limit support
Anything else?
No response