Live data from Hacker News

On Running systemd-nspawn Containers (2022)

benjamintoll.com

21–30 of 59 posts

Re: On Running systemd-nspawn Containers (2022)

#21
post #8

> Unfortunately, though, most developers don’t even know that there are options outside of Docker, or that they’re not as “convenient”. > Hopefully, this article has disabused some of that notion. If that was the goal, it seems terribly complicated when compared with podman.

Author should consider running it inside Docker for more convenient setup.

Re: On Running systemd-nspawn Containers (2022)

#23
post #7

On an unrelated note, is there a way to share some negative feedback on systemd projects without incurring significant hit to karma?

Do novel issues get a negative reaction? Retreading old grievances is pointless, but I think if you have a reasonable new gripe (that's not dae hate systemd like me?)you would be just fine.

Re: On Running systemd-nspawn Containers (2022)

#24

I used nspawn to get a system running in the most ridiculous way. A debian aarch64 vm on kvm starting a systemd-nspawn for an unpacked raspberry pi 3 iso. It works way too well judging by how ridiculous it was. Still saved me a few days instead of setting things up myself. I actually liked how easy it is to spin up nspawn as a systemd service [Unit] Description=Raspberry Image Machine After=multi-user.target [Service…

hmm this is very interesting. I am wondering though? Is there something like systemd-nspawn that doesn't require root?

If file system level isolation is enough for you, take a loot at schroot (https://linux.die.net/man/1/schroot) which allows root-less chroot. You can use something like debootstrap to get a complete userland into a user controlled directory and use schroot to chroot into it without root level access.

Re: On Running systemd-nspawn Containers (2022)

#25
I've used lots of different container-types over the years to replace VMs with lightweight containers, but right now I'm running systemd-nspawn, and I really, really like it.

The way it integrates with systemd, both inside and outside the container makes it a no-brainer for app-isolation when the app in question is a bit too complex for just being a service-unit in itself, and you don't want to lose observability by hiding everything behind some obscure docker wall.

The way everything integrates into systemctl and you can get aggregated stats for your entire machine and all its sub-containers... Amazingly nice.

I just can't imagine any better way of managing containers on a Linux system than this.

Only thing I would complain about is the name. They really could have come up with something a bit more catchy or self-descriptive. This is probably the only systemd type service which does not immediately shout out what its about, so most people are probably not even aware that systemd can manage containers for you.

Re: On Running systemd-nspawn Containers (2022)

#26
post #8

> Unfortunately, though, most developers don’t even know that there are options outside of Docker, or that they’re not as “convenient”. > Hopefully, this article has disabused some of that notion. If that was the goal, it seems terribly complicated when compared with podman.

I was thinking similarly. All of those steps to circumvent the OCI image infrastructure just to use systemd…

OCI is for running prepackaged software in black boxes from the internet, where you have no interest or ownership of the container internals.

Most of my containers are not like that. Well, actually none are.

systemd-nspawn is for running your own containers, with a VM-like usage pattern (ie not immutable), deployed as part of your overall systemd based infrastructure for when the thing you need to manage is "too big" to be deployed as its own systemd-service unit, but you still want to be able "to systemd" it.

This fits my use-case perfectly.

Re: On Running systemd-nspawn Containers (2022)

#27
post #20

This is very interesting! I only heard about systemd-nspawn last night.

Most systemd-projects have a name which immediately shouts out what it does, so you can easily tell if it is relevant for your needs or not.

systemd-nspawn is probably the only project without such a name, so most people don't know about it, nor what it does, and therefore never looks any more into it.

And that's a shame really, because it's fantastic technology.

Re: On Running systemd-nspawn Containers (2022)

#29
post #21
post #8

> Unfortunately, though, most developers don’t even know that there are options outside of Docker, or that they’re not as “convenient”. > Hopefully, this article has disabused some of that notion. If that was the goal, it seems terribly complicated when compared with podman.

Author should consider running it inside Docker for more convenient setup.

Never. If he wanted to go the containers route, Podman is there. There is no reason to use Docker anymore. (Only a satellite tool like docker-compose is not 1-1 compatible with podman-compose, but podman has other ways to orchestrate with systemd as part of podman vision for orchestrating.)
Post reply on HN