rootless-containers / slirp4netns

User-mode networking for unprivileged network namespaces
GNU General Public License v2.0
715 stars 82 forks source link

How to configure port forwarding? #338

Closed zopsicle closed 4 months ago

zopsicle commented 4 months ago

slirp4netns surely supports port forwarding. For instance, https://rootlesscontaine.rs/how-it-works/netns/incoming/ reads:

slirp4netns also has its own port forwarder.

But the manual does not document anything about this (how it works nor how to configure it).

(Or maybe I just don’t understand what “port forwarding” means in this context; I assume that “port forwarding” means if the host connects to port X and the container listens on port Y, a connection can be established if slirp4netns is configured to map X to Y).

zopsicle commented 4 months ago

Oh, apparently this can only be configured through the API socket, not the command line. It is documented under “API SOCKET”.