[systemd-devel] systemd-nspawn and volatile option side effects
Joel GUITTET
jguittet.opensource at witekio.com
Thu Nov 14 08:54:40 UTC 2024
Hi systemd,
I'm working with machinectl to control containers, thus using the systemd service "/usr/lib/systemd/system/systemd-nspawn at .service".
Currently my ExecStart option is the following: "ExecStart=systemd-nspawn --quiet --boot --network-bridge=br0 --read-only --volatile=yes --notify-ready=yes --settings=override --slice=${SLICE} --machine=%i"
With this systemd-nspawn options I get a running containers with the possibility to connect to the shell of the container with machinectl, so that I can configure the container after it is ready and check my applications. This is fine.
However, the usage of the --volatile=yes option mounts the container as a tmpfs and the immediate impacts is that several directories are not available inside the containers. Particularly "/opt" that I need for my application.
Removing or changing the --volatile option to other values (overlay, state, no) I'm no more able to connect to the shell of the container, I get the following error: "Failed to get shell PTY: There is no system bus in container hello-world." (where hello-world is the name of my container)
=> I previously added the --volatile=yes option to permit the access to the shell of the container. How to get the access to the shell but keeping full content of the container, particularly my "/opt" directory ??
Thanks
Regards
Joel
More information about the systemd-devel
mailing list