blob: 4dba2ec351bbf1de1a517eb3ed1e70b6b5b97d37 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
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]]
|