summaryrefslogtreecommitdiff
path: root/NixOS - Declarative container management.md
diff options
context:
space:
mode:
Diffstat (limited to 'NixOS - Declarative container management.md')
-rw-r--r--NixOS - Declarative container management.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/NixOS - Declarative container management.md b/NixOS - Declarative container management.md
new file mode 100644
index 0000000..6262a90
--- /dev/null
+++ b/NixOS - Declarative container management.md
@@ -0,0 +1,25 @@
+Specify containers in the host's `configuration.nix`.
+
+```nix
+{
+ containers.foo =
+ {
+ config = { config, pkgs ... }:
+ {
+ autoStart = true; # This will start the container automatically.
+ privateNetwork = true;
+ hostAddress = "192.168.100.10";
+ localAddress = "192.168.100.11";
+ }
+ }
+}
+```
+
+Running containers are updated in-place without rebooting.
+
+Declarative containers share the host's networking namespace by default, see above example on how to give it its own network.
+
+If the configuration is deleted from the host's config and the config is rebuilt the container will be disabled. This **does not** delete its root filesystem. To delete the root fs use the [[NixOS - Imperative container management]] method.
+
+---
+[[NixOS - Containers]] \ No newline at end of file