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

Share a network between 2 rootless instances #367

Open
Youpiiiii opened this issue May 18, 2023 · 5 comments
Open

Share a network between 2 rootless instances #367

Youpiiiii opened this issue May 18, 2023 · 5 comments
Labels
question Further information is requested

Comments

@Youpiiiii
Copy link

Youpiiiii commented May 18, 2023

Hello,

I trying rootless for docker but I can't find solution to share a network between 2 rootless instances.
I have a machine with some users. Each users have a rootless instance. But for HAproxy and Traefik we need a network for the backend.
Is there something I missed or a workaround to bypass this problem?

Thank you

@AkihiroSuda
Copy link
Member

vde_plug may cover your usecase?

https://github.com/rd235/vdeplug4
https://github.com/rootless-containers/slirp4netns/blob/v1.2.0/slirp4netns.1.md

(host)$ vde_plug --daemon switch:///tmp/switch null://
(host)$ nsenter -t $(cat /tmp/pid-instance0) -U --preserve-credentials -n
(namespace-instance0)$ vde_plug --daemon vde:///tmp/switch tap://vde
(namespace-instance0)$ ip link set vde up
(namespace-instance0)$ ip addr add 192.168.42.100/24 dev vde
(namespace-instance0)$ exit
(host)$ nsenter -t $(cat /tmp/pid-instance1) -U --preserve-credentials -n
(namespace-instance1)$ vde_plug --daemon vde:///tmp/switch tap://vde
(namespace-instance1)$ ip link set vde up
(namespace-instance1)$ ip addr add 192.168.42.101/24 dev vde
(namespace-instance1)$ ping 192.168.42.100

@AkihiroSuda AkihiroSuda added the question Further information is requested label May 29, 2023
@Youpiiiii
Copy link
Author

As I understand it, I must use docker pid like this:
nsenter -t $(cat /run/user/1001/docker.pid) -U --preserve-credentials -n
If yes, I have this error with "ip link set vde up" :
Cannot find device "vde"

@AkihiroSuda
Copy link
Member

Cannot find device "vde"

Please make sure to run vde_plug commands above

@Youpiiiii
Copy link
Author

vde_plug --daemon switch:///tmp/switch null:// : create a daemon
but
vde_plug --daemon vde:///tmp/switch tap://vde : doesn't create daemon, He stop immediately without error. I see nothing in the logs.

@Youpiiiii
Copy link
Author

I had a little time so I tried again.
I tried vde_plug switch:///tmp/switch null:// without daemon and I have a permission denied.
To set all rights change nothing, always permission denied

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

No branches or pull requests

2 participants