Tell us about your request
Provide each container started from Docker Desktop with an IP address that can be used to address the container from the host.
Which service(s) is this request for?
Docker Desktop
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
Some users would like to have IP addresses for each container. Many of the use cases for this seem to be when people have a lot of replicates of a container that all use the same port.
This used to be possible on Windows using DockerNAT. This was never a supported feature but an implementation detail, but some people had discovered it, and were relying on it until DockerNAT was removed. This functionality was never available on Mac.
Are you currently working around the issue?
One user https://github.com/docker/for-win/issues/5538#issuecomment-611126380 has reported using compose ports syntax to achieve the same goal.
Additional context
https://github.com/docker/for-win/issues/5538
Running samba in a docker container to share docker volumes with windows host machine.
Cannot forward the ports when running, docker run -d -it -p 139:139 -p 445:445........, windows is already using port 445. If you try something like docker run -d -it -p 139:139 -p 4445:445..... the container runs but I can't get the drive mapped in windows. It appears that windows requires samba to be at port 445.
I believe the container needs its own IP address on a network accessible by the host.
From what I understand by listening to
the original motivation for VPNKit was to have a solution that gets containers online with zero minimal footprint in the networking stack of the host. VPNKit definitely does achieve that, but at the cost of IP connectivity between host and container.
The lack of "IP addresses for containers" on Mac really makes it feel "second class". I think it should be a priority to bring it on par with Linux.
As an outsider, the obvious question is, why is there no additional interface that bridges between macOS and the Linux VM running in HyperKit? VPNKit could still be used as the default gateway, like it's done now, and connections to the host could be routed through the bridge.
Most helpful comment
Running samba in a docker container to share docker volumes with windows host machine.
Cannot forward the ports when running, docker run -d -it -p 139:139 -p 445:445........, windows is already using port 445. If you try something like docker run -d -it -p 139:139 -p 4445:445..... the container runs but I can't get the drive mapped in windows. It appears that windows requires samba to be at port 445.
I believe the container needs its own IP address on a network accessible by the host.