[systemd-devel] systemd-nspawn and process spawning using nsenter issue
Lennart Poettering
lennart at poettering.net
Mon Nov 2 15:05:10 PST 2015
On Mon, 02.11.15 14:52, Aliaksei Sheshka (sheshkaoss at gmail.com) wrote:
> On Mon, Nov 2, 2015 at 1:05 PM, Lennart Poettering
> <lennart at poettering.net> wrote:
>
>
> >
> > BTW: another way to deal with network namespaces in systemd is via
> > PrivateNetwork=yes and JoinsNamespaceOf=, but I am not whether that
> > matches what you want to do...
>
> Perhaps, I've tried
>
> [Unit]
> Description=mydaemon withing c7-test network context
> After=network.target
>
> [Service]
> TimeoutStartSec=10
> ExecStart=/usr/sbin/mydaemon
> JoinsNamespaceOf=c7-test.service
> PrivateTmp=yes
> PrivateNetwork=yes
>
> [Install]
> WantedBy=multi-user.target
>
>
> but looks likes it creates new namespace, because 'mydaemon' sees only
> 127.0.0.1 with such unit.
> c7-test unit is 100% running.
> Another question, would 'machinectl poweroff c7-test' terminate
> [properly configured] 'mydaemon' unit as well ?
Note that all units you join need to have PrivateNetwork=yes set if
they shall live in the same namespace. Did both your units have this set?
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list