Skip to content
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

Use "cni" as a default rootless_networking method at least in macOS #4

Open
Tracked by #5
theomega opened this issue Sep 10, 2021 · 8 comments
Open
Tracked by #5
Assignees

Comments

@theomega
Copy link

If I start an nginx container using

$ podman run --rm --name nginx -p 80 docker.io/library/nginx

and then grab the port:

$ podman port nginx
80/tcp -> 0.0.0.0:36985

how do I connect to this? So which IP am I supposed to use? I tried the IP 192.168.127.2 which the VM has associated (found out via ip a s inside podman machine ssh), but that does not work, the connection times out.

What am I missing?

@simnalamburt simnalamburt transferred this issue from simnalamburt/homebrew-x Sep 10, 2021
@simnalamburt
Copy link
Owner

simnalamburt commented Sep 10, 2021

Actually it's podman's bug : containers#11396

You can add this to your ~/.config/containers/containers.conf

[containers]
rootless_networking = "cni"
References

@simnalamburt
Copy link
Owner

@theomega Let me patch podman-apple-silicon to make this change by default on macOS. I'll ping you again when I have a next release

@simnalamburt simnalamburt reopened this Sep 10, 2021
@simnalamburt simnalamburt changed the title How do you access forwarded ports from the host? Use "cni" as a default rootless_networking method at least in macOS Sep 10, 2021
@simnalamburt simnalamburt pinned this issue Sep 10, 2021
@simnalamburt simnalamburt unpinned this issue Sep 10, 2021
@simnalamburt simnalamburt pinned this issue Sep 10, 2021
@simnalamburt simnalamburt self-assigned this Sep 10, 2021
@theomega
Copy link
Author

For reference, after modifying the containers.conf, you need to make sure that there is a network of the name podman you can create one using podman network create podman.

Also, to access a container from your host machine (so from i.e. Safari), you use localhost as hostname and the port you grab from podman ports -a. Accessing the port on the VM IP (192.168.127.2) does not work from the host.

So thanks @simnalamburt that helps.

@simnalamburt
Copy link
Owner

containers#11552 has been merged

TODO:

  • Release podman-apple-silicon again using latest main branch

@simnalamburt
Copy link
Owner

NOTE: upstream podman's Apple Silicon support is almost finished. Once containers#11449 is merged and released, you won't even need this forked version of podman anyway.

@simnalamburt
Copy link
Owner

@theomega Can you try brew install --HEAD podman? It should use cni as a default rootless network method and support qemu-hvf by default.

@theomega
Copy link
Author

To test this, should I delete ~/.config/containers/? Or just remove the rootless_networking = "cni" line?

@simnalamburt
Copy link
Owner

simnalamburt commented Sep 15, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants