Re: Systemd-nspawn single process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx> a écrit :
On Fr, 01.12.23 14:03, Warex61 YTB (thomasdabout61@xxxxxxxxx) 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

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux