Correct way to create a podman-network that can only communicate to services bound on localhost. #22570
-
Essentially, I have a couple of services that are bound to localhost that I want to expose to a couple of processes running inside a container, where the container should not be able to communicate to any routable networks/dns/etc. The processes inside the container connect to I thought I remembered being able to do something similar with CNI's host-device plugin, but with CNI now being deprecated for What's the right way to do this? Also, if possible, I'd like to keep the containers as rootless. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There are many ways to do this :) I just happened to post an overview at #22653 (comment). In your specific case, the With pasta alone (without the
and in another terminal (pasta will detach the network namespace):
Inside the network namespace, there are no addresses other than loopback ones:
|
Beta Was this translation helpful? Give feedback.
There are many ways to do this :) I just happened to post an overview at #22653 (comment).
In your specific case, the
-T
/--tcp-ns
option for pasta would probably be the best fit: that will map a localhost-bound port inside the container to a local port on the host. At that point, you could drop the non-loopback interface in the container.With pasta alone (without the
--config-net
option, that Podman passes by default), you can already try that out:and in another terminal (pasta will detach the network namespace):
Inside the network namespace, there are no addresses other than loopback ones: