[systemd-devel] Systemd-nspawn single process
Warex61 YTB
thomasdabout61 at gmail.com
Fri Dec 15 09:29:06 UTC 2023
Hello,
Thanks for the tip, I've taken a more recent version of systemd-nspawn and
it now works.
I now have another question: I want to set up a signle process. I have a
problem on the network side, I want to launch my signle process by
connecting it to a bridge. In the .nspawn file, in the network section, I
specified the use of the bridge. Then systemd-nspawn, when the container is
launched, will create a pair of veths, one inside the container (host0) and
the other on my host connected to the bridge. I want my host0 interface,
which is inside the container, to take a static IP and the interface to be
up directly when I launch my container. To do this I've created a
process1.network configuration file in /etc/systemd/network
[Match]
Virtualization=container
Driver=veth
Host=process1
[Network]
Address=10.10.0.15/23
Gateway=10.10.0.1
I also tried mounting this file in /etc/systemd/network in my container
host0.network
[Match]
#Virtualization=container
Name=host0
[Network]
Address=10.10.0.15/23
Gateway=10.10.0.1
Despite these two approaches, I can't manage to allocate a static IP
address to host0 when the container is launched, so I have to do it
manually in the container using the :
ip addr add 10.10.0.15/23 dev host0
ip link set host0 up
Shouldn't we be able to specify the container ip directly in the
process1.nspawn file?
Thanks.
Le ven. 1 déc. 2023 à 22:22, Lennart Poettering <lennart at poettering.net> a
écrit :
> On Fr, 01.12.23 14:03, Warex61 YTB (thomasdabout61 at gmail.com) wrote:
>
> > Hello,
> > I would like to use systemd-nspawn to create a container that can launch
> a
> > single process as pid 1 and mount its configuration files. I want the
> > container to be as light as possible. Is there any way of creating a
> > container using nspawn without using bootstrap ?
> >
> > For example, using this command, without using a bootstrap
> >
> > systemd-nspawn -M process -D /etc/systemd/nspawn/process
> > /etc/systemd/nspawn/process.nspawn
> > I get the following error
> >
> > Directory /etc/systemd/nspawn/process doesn't look like it has an OS
> tree.
> > Refusing.
> > What are the conditions for nspawn to consider an OS tree in
> > /etc/systemd/nspawn/process ?
>
> You are using an ancient version of nspawn. Since 2y or so the message
> reads:
>
> Directory %s doesn't look like it has an OS tree (/usr/ directory
> is missing). Refusing.
>
> And that's your explanation: you need an /usr/ directory.
>
> Lennart
>
> --
> Lennart Poettering, Berlin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20231215/4a614923/attachment-0001.htm>
More information about the systemd-devel
mailing list