Seems to be an issue. The containers get ips under the right network, and can talk to each other, but for me it’s a real network provided by my unifi USG, where the host can ping the router on .1, but none of the created containers can.
I’ve tried turning on promiscuous mode, and allowing mac spoofing in hyper-v.
But if I try the same set up with a raspberry pi, then it works as I expect.
docker network create -d macvlan --subnet=192.168.40.0/24 --attachable --gateway=192.168.40.1 -o parent=eth0.40 vlan40
docker run -it --rm --ip=192.168.40.50 --net=vlan40 alpine /bin/sh
eth0.40: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST> mtu 1500
inet6 xxxxxxxxxxxxxxxxxxxxxxxxx prefixlen 64 scopeid 0x20<link>
ether xx:xx:xx:xx:xx:xx txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 44 bytes 4320 (4.3 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
So the interface is being created, but for the life of me can’t get it working on either of 2 hyper-v hosts.