You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Compose V1 if a service is attached to multiple networks and mac_address is set the chosen MAC is applied to the interface of the network with the highest priority. Network priority is determined based on the priority property (if set), and otherwise falls back to being based on the alphabetical order of network names (highest first).
In Compose V2 the chosen MAC address seems to be randomly assigned to either network.
Steps to reproduce the issue:
Use this compose file
services:
web:
image: alpinecommand: ip lnetworks:
back:
priority: 100front:
priority: 1000mac_address: 00:bb:bb:bb:bb:bbnetworks:
front:
driver_opts:
com.docker.network.container_iface_prefix: frontback:
driver_opts:
com.docker.network.container_iface_prefix: back
Run docker-compose-v1 up
Attaching to bug-compose-mac_web_1
[...]
web_1 | 216: front0@if217: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP
web_1 | link/ether 00:bb:bb:bb:bb:bb brd ff:ff:ff:ff:ff:ff
web_1 | 218: back0@if219: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP
web_1 | link/ether 02:42:ac:15:00:02 brd ff:ff:ff:ff:ff:ff
bug-compose-mac_web_1 exited with code 0
Run docker compose up
[+] Running 1/1
⠿ Container bug-compose-mac_web_1 Recreated 0.1s
Attaching to bug-compose-mac-web-1
[...]
bug-compose-mac-web-1 | 220: front0@if221: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP
bug-compose-mac-web-1 | link/ether 02:42:ac:14:00:02 brd ff:ff:ff:ff:ff:ff
bug-compose-mac-web-1 | 222: back0@if223: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP
bug-compose-mac-web-1 | link/ether 00:bb:bb:bb:bb:bb brd ff:ff:ff:ff:ff:ff
bug-compose-mac-web-1 exited with code 0
Describe the results you received:
With compose v1, 00:bb:bb:bb:bb:bb is affected to front0.
With compose v2, 00:bb:bb:bb:bb:bb is affected to back0.
Describe the results you expected:
I expected 00:bb:bb:bb:bb:bb to always be affected to front0 in v2 because front has higher priority, just like in v1.
Additional information you deem important (e.g. issue happens only occasionally):
In V2 it seems like the network to which mac_address is assigned to is random and unpredictable, or if there's any logic I couldn't understand it. I've had occasions where even a totally minute modification like changing priorities to 100/100 instead of 10/100 or changing the service command and that alone flipped the attribution of the MAC between front0 and back0.
Description
In Compose V1 if a service is attached to multiple networks and
mac_address
is set the chosen MAC is applied to the interface of the network with the highest priority. Network priority is determined based on thepriority
property (if set), and otherwise falls back to being based on the alphabetical order of network names (highest first).In Compose V2 the chosen MAC address seems to be randomly assigned to either network.
Steps to reproduce the issue:
docker-compose-v1 up
docker compose up
Describe the results you received:
With compose v1,
00:bb:bb:bb:bb:bb
is affected tofront0
.With compose v2,
00:bb:bb:bb:bb:bb
is affected toback0
.Describe the results you expected:
I expected
00:bb:bb:bb:bb:bb
to always be affected tofront0
in v2 becausefront
has higher priority, just like in v1.Additional information you deem important (e.g. issue happens only occasionally):
In V2 it seems like the network to which
mac_address
is assigned to is random and unpredictable, or if there's any logic I couldn't understand it. I've had occasions where even a totally minute modification like changing priorities to 100/100 instead of 10/100 or changing the service command and that alone flipped the attribution of the MAC between front0 and back0.Output of
docker compose version
:Output of
docker info
:The text was updated successfully, but these errors were encountered: