diff options
Diffstat (limited to 'NixOS - Imperative container management.md')
-rw-r--r-- | NixOS - Imperative container management.md | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/NixOS - Imperative container management.md b/NixOS - Imperative container management.md new file mode 100644 index 0000000..7099e6e --- /dev/null +++ b/NixOS - Imperative container management.md @@ -0,0 +1,25 @@ +As root using `nixos-container`. + +Container root: `/var/lib/nixos-containers +Config file: `/etc/nixos-containers` + +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]]
\ No newline at end of file |