Docker network connections from Linux Container to Windows

I want to connect a Linux container to a specific network adapter on a Windows host (host-only VMnet1) to allow connection between the Container and a Windows VM hosted on the same Windows host. The underlying desired connection between Container and VM is TCP to specific ports.
I have tried :- docker network create -d macvlan --gateway <> --subnet <> - o parent=eth0 app-network
I have also tried :- docker network create -d ipvlan --gateway <> --subnet <> - o parent=eth0 app-network
In each case, I set the gateway to the IP address of VMnet1 network adapter, with the sub net mask set to the subnet mask of VMnet1.
This does create a network without whinge and on running the Container app with devcontainer.json setting
the network to app-network, the container command line in VS code does show a container ip address within the subnet, but it does’nt provide the desired connectivity.

I have also tried :- docker network create -d transparent -o com.docker.network.windowsshim.interface=“VMnet1” app-network
However this bombs out with plugin “transparent” not found

I have got the impression from various Google searches that macvlan & ipvlan drivers are for Linux Containers with a Linux host and the transparent driver is for a Windows container and Windows host.

How can I achieve what I need to with a Linux container and a Windows host. I am unfortunately something of a newbie with Docker Containers and also a long way short of being a networking guru.
We are using Rancher Desktop 1.20 as a docker desktop with WSL 2 running.
Any help would be appreciated.

We can not speak about how Rancher Desktop implements things. We can only speak how it’s done in Docker Desktop. If you want to know how it’s done in Rancher Desktop, you will need to ask the support channels for Rancher Desktop.

With WSL2 Backend macvlan and ipvlan do not work like the user expects it. WSL2 uses a system vm, which runs all distributions.

Docker Desktop runs its Docker Engine in a container (not a docker container though), so macvlan and ipvlan do working within the Docker Engine environment, but are not exposed to the Docker Desktop WSL distribution. Neither WSL2’s networkMode=nat, nor networkMode=mirrored are a network bridge.

If you want to use macvlan/ipvlan, you will need to use a Linux vm running docker-ce, which is connected to a network bridge.

We’ve managed to work-around the problem with a combination of netsh proxyport in the host and setting the network in devcontainer.json to host. I think this is probably not ideal from a security point of view, however it will do for prototyping and development. For production, we would most likely use Linux containers on a Linux host, which I think should make network setup easier. Thanks however to the people who replied.