this post was submitted on 18 Mar 2025
22 points (100.0% liked)
Nix / NixOS
2052 readers
10 users here now
Main links
Videos
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
NixOS container is using systemd-nspawn/systemd container. Both are using Linux namespaces and cgroups.
A disadvantage of NixOS container is that it only supports rootful containers, i.e. root inside the container has the same privileges as root outside the container. This is also true for docker unless configured otherwise.
OCI containers (Docker, Podman) are often created by upstream themselves, which you might prefer.
I configure containers by using the podman backend (default) and
virtualisation.oci-containers.conrainers
, which supports rootless podman [1]. Imo rootless is the best and most secure way to run containers on NixOS.Edit: I prefer NixOS packages if available and only use OCI (Docker) containers if not. The main reason being the simplified declarative configuration through NixOS options, which can also be used inside NixOS container.
[1]
virtualisation.oci-containers.containers.<name>.podman.user
Damn, didn't know it was rootful only. Work is going nuts atm about non zero userId in containers.
There goes my idea about solving some of our packaging a distribution problems with nix build.
Just to make sure, it's the rootless Daemon?
Also, another option for OP; nixos base image docker container