Gentoo Archives: gentoo-user

From: Rich Freeman <rich0@g.o>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] VRFs / Jails / Containers
Date: Mon, 04 Feb 2019 18:56:05
Message-Id: CAGfcS_=bgrevSRm9F3nic4Sy+KOKR5hx_48M4hvLy_HKOBLnow@mail.gmail.com
In Reply to: Re: [gentoo-user] VRFs / Jails / Containers by Grant Taylor
1 On Mon, Feb 4, 2019 at 1:44 PM Grant Taylor
2 <gtaylor@×××××××××××××××××××××.net> wrote:
3 >
4 > I'm starting to wonder if I'm going to be better off writing new scripts
5 > that will match existing init scripts and their methodology to
6 > (re)start/stop namespaces / containers / jails. Perhaps firejail will
7 > give me what I want or provide insight.
8 >
9
10 IMO I would separate your container logic from your service manager logic.
11
12 If you have a script that launches a container, then all you need is a
13 generic init.d script that runs it.
14
15 I launch nspawn containers from systemd units all the time. The only
16 logic in the units is running the command line to start nspawn.
17
18 IMO if you start mixing the two it will just make it harder to
19 maintain. Sure, an init.d script CAN do anything, but that doesn't
20 mean that you should do it this way.
21
22 Without creating a separate reply I wanted to react to your other
23 email detailing your config. It strikes me that you might not even
24 need containers to set up all those interfaces and the routing between
25 them. However, the container probably still makes sense so that
26 random processes trying to listen on 0.0.0.0 on the host don't end up
27 attaching to all those virtual interfaces.
28
29 Really all you need is some initialization inside each container and
30 then the kernel is doing all the work. You don't really need any
31 userspace process running in the container except for the fact that
32 kernel namespaces are attached to processes. As a result, I'd suggest
33 considering using sysvinit inside your containers to do the work. You
34 might run openrc/netifrc to do the network setup inside each
35 container, or just have sysvinit run a shell script that initializes
36 and then terminates, leaving init running childless indefinitely (I
37 assume it supports this). If you want a process to noop indefinitely
38 at minimal cost that is basically the definition of what sysvinit
39 does...
40
41 --
42 Rich

Replies

Subject Author
Re: [gentoo-user] VRFs / Jails / Containers Grant Taylor <gtaylor@×××××××××××××××××××××.net>