I’m trying to configure a swarm using a Macvlan network driver. I have 2 CentOS nodes running Docker 17.10.0-ce, and 3 containers deployed on them.
On each node I run this command:
docker network create --config-only --subnet 192.168.211.0/24 --gateway 192.168.211.2 -o parent=ens33 --ip-range 192.168.211.128/25 pubnet
then on the manager node I run
docker node network create -d macvlan --scope swarm --config-from pubnet swarm-macvlan
I then deploy a stack using
docker stack deploy --compose-file my-stack.yml my-stack
All 3 containers deploy successfully, but when I run
docker network inspect swarm-macvlan
on node 1, I see 2 containers with unique MAC addresses and IP addresses (192.168.211.128 and 129, as expected), but on node 2 I see the 3rd container with the same MAC and IP address as one of the containers on node 1.
In short, it seems that the Macvlan driver is assigning unique MAC & IP addresses for individual nodes, but not across the entire swarm.
This doesn’t appear to be expected behaviour. Has anyone had any success in using a setup similar to this?