As root using `nixos-container`. [[NixOS - container directories]] Create with: `nixos-container create foo`. During create we can pass `--config` or `--config-file`. By default it gets an address in the range `10.233.0.0/16` but this can be overridden using `--host-address` and `--local-address`. It needs to be started explicitly `nixos-container start foo`. The container runs as a systemd unit on the host `systemctl status container@foo`. Login can be done as root using `nixos-container root-login foo` whilst regular authenticated login is also possible with `login`. Arbitrary command execution: `nixos-container run foo -- whoami` Build and activate new configuration: `nixos-container update foo`, this reads `/var/lib/nixos-containers/foo/etc/nixos/configuration.nix`. ^ Also allows passing in `--config` from the CLI, this overrides its `configuration.nix`. Start/stop using systemd or `nixos-container start|stop`. Destroy completely using: `nixos-container destroy foo`. --- [[NixOS - Containers]] [[NixOS - Advantage of imperative container management]]