LCOW IPVLAN or MacVLAN troubleshooting

hi all, reasonably sure this isn’t user error (or well maybe it is, please be the judge)

i’ve successfully installed docker for windows, using WSL2 engine

using the default bridge, everything works. (in terms of exposing ports, accessing them on the network and such)

my problem is that I wish to use IPVLAN or MACVLAN in order to give each container its own exclusive ipv4 address that is accessible by everybody on the network.

This functionality worked and was very easy to set up in regular docker on a unix server, but it is seemingly impossible to do so on a windows machine, using docker desktop for windows LCOW WSL2

Has anybody had experience here? i’ve spent the past 5 hours googling around this topic, and can’t seem to find any solution.

When I do things like

docker create -d ipvlan --subnet=192.168.1.0/24 --gateway=192.168.1.1 -o ipvlan=l2 -o parent=eth0 ipvlan_test
it doesn’t work how i’d expect. Weirdly that parent interface ‘eth0’ doesn’t exist on the windows side either, i’m not sure where the name eth0 is coming from but it appears to be the only valid input. using the real windows based ipconfig names result in errors which prevent the command from executing.

In terms of usability after execution, the network appears in docker network list and i can assign it to any container, but ports are not exposed and the container is not reachable.

Inside the container, when attempting to curl, ping, nslookup etc nothing works.

is IPVLAN supported in LCOW WSL2 Docker desktop for windows?

First of all, what is “LCOW wsl2”? I think you are just confused because lcow was replaced by WSL2 but it is just “WSL2” now.

And second, you will not be able to use macvlan with Docker Desktop, since it runs everything inside a virtual machine having its own private network. Even if you could set a macvlan using the IP range of Docker Desktop’s WSL2 backend, that wouldn’t be on your LAN network so I don’t think it would make sense.

apologies if the terminology is not correct, I assumed LCOW was the distinction between running windows containers vs linux containers (LCOW vs WCOW)

WSL2 is what I will refer to it going forward, thank you

what about ipvlan? that also out? its kinda weird that some of these commands aren’t restricted on windows if they are effectively non-functional

Docker is the same Docker in the virtual machine. When you run a Docker daemon on a server and configure your docker client to connect to the remote server, you are still able to use any parameter but you need to know where your daemon is running and what parameters make sense. Docker Desktop is like a remote server, except it is a local virtual machine so it is just remote in the docker client’s point of view. Every docker command that you run will make changes in the virtual machine. Docker Desktop also has some additional feature like forwarding the ports from your Windows host, because it would be almost useless without that feature.

When you switch to Windows containers, then you will have different parameters allowed by the client but as long as you use Linux containers, every parameter is valid (as far as I know) and you can decide when it makes sense to use. Maybe it is useful in some cases, so it is not restricted.

Yes, it is. If you want, you can ask for a new feature to be able to run Docker Desktop’s virtual machine on the LAN network using bridges instead of using NAT. If it can be solved on each platform (Windows, Mac, Linux) there is a better chance it will be implemented some day.

Until that, if you don’t need Docker Extensions and Development environment, and you don’t want to use Docker from your host machine, you can create a virtual machine with Hyper-V or other virtualization software and run Linux inside that VM. If you can run that VM in bridged mode, maybe you can use macvlan in that VM, but I have never tried it.