Skip to content

[Rootless] Access containers via IP outside of namespace #2070

Answered by fahedouch
thomascft asked this question in Q&A
Discussion options

You must be logged in to vote

I'm working on a project where I'd like containers to be directly accessible via IP from the host

unprivileged user cannot manage the host network stack. for this reason we pass through rootlesskit namespace ( slirp4netns) to go outside.

to acheive this, a workaroud is to nsenter into the container namespace from host and then access container using the container ip :

get container pid:

rootless@26bdbd470ef7:/go/src/github.com/containerd/nerdctl/Dockerfile.d$ nerdctl ps
CONTAINER ID    IMAGE                              COMMAND             CREATED           STATUS    PORTS    NAMES
e36b69bd82c8    docker.io/library/alpine:latest    "sleep infinity"    19 minutes ago    Up               …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by fahedouch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants