-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
podman --network --host doesn't work on MacOS #15664
Comments
The podman machine vm has its own network stack, |
I see, thanks for the context! I just tried with docker-desktop but it doesn't work either. Though, then is there an ip / hostname of the linux VM exposed to the host Mac that I can access? |
Since we use user space networking for the VM it is impossible to access the VM via ip address from the host. You have to forward ports to access it. From within the VM you can use |
I see, that's unfortunate :( I wanted to avoid having to specify exact ports to access but that seems unavoidable. |
Note on a usecase: We have a shared development environment container image, which we do many random stuff inside, and it would be very convenient not having to specify which port to expose ahead, and not even think about it, just like developing on the host machine. |
well, in many ways the networking is similar to |
Yes. But let's say while working inside the container, you suddenly want to run a test server on port :8889. With |
A friendly reminder that this issue had no activity for 30 days. |
It will be a good feature to support but it seems there is no good way to implement it at this moment. I think it's good to update the document and close the bug as "won't fix". |
Is it possible to elaborate?. I seem to need to use net host to run some containers. How does podman -p expose ports to begin with? |
@btrepp I recommend to open a discussion if you have general questions instead of commenting on existing issues. |
Hi @Luap99. That link is greatly useful. I came to this thread because I had this exact bug, so I don't think this is a general question, more discussion about this actual bug, so others can help understand the issue. In fact the gvisor-tap-vsock repo has some inspiration as to a work-around so at least I can 'sort-of' use net host, even if there's a bit of futzing. Hack to at least get some ports forwardedGvproxy is exposing a ssh port, so we can be cheeky and use SSH port forwarding. You can do this in gvproxy too, but I am not 100% sure it is safe to connect to that auto-generated sock that gvproxy is currently using. 501 22429 1 0 8:27pm ?? 0:05.96 /opt/homebrew/Cellar/podman/4.3.0/libexec/podman/gvproxy -listen-qemu unix:///var/folders/c1/vbnsmxm507n4tymmlvzvx45r0000gn/T/podman/qmp_podman-machine-default.sock -pid-file /var/folders/c1/vbnsmxm507n4tymmlvzvx45r0000gn/T/podman/podman-machine-default_proxy.pid -ssh-port 55816 -forward-sock /Users/beautrepp/.local/share/containers/podman/machine/podman-machine-default/podman.sock -forward-dest /run/podman/podman.sock -forward-user root -forward-identity /Users/beautrepp/.ssh/podman-machine-default So we can see my SSH is on port 55816. Using root, with an identity file.
Which lets me at least expose the ports needed by hand. This is obviously not 'exactly' the same as net=host, but could be helpful for someone who needs to use net=host, and doesn't want to spin up a whole seperate VM stack to do so. Which was my case. There is also probably a much better way speaking to the gvsock socket directly, but I think Podman is only spinning up a tcp port for ssh at the moment.. which makes sense, but perhaps this is configurable |
A friendly reminder that this issue had no activity for 30 days. |
Yeah it would be nice to have configurability of the gvisor-vsock to be able to emulate net=host a bit better. |
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
podman --network host
does not work on MacOSSteps to reproduce the issue:
podman run --rm -it --network host nginxinc/nginx-unprivileged
http://0.0.0.0:8080/
on a host web browser.Describe the results you received:
"This site can’t be reached. 0.0.0.0 refused to connect."
Describe the results you expected:
"Welcome to nginx!"
Note:
podman run --rm -it -p 8080:8080 nginxinc/nginx-unprivileged
works.Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:Output of
podman info
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):
Macbook Pro 2019
The text was updated successfully, but these errors were encountered: