summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2019-04-22 17:42:45 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2019-04-22 18:13:45 +0200
commitc957341ef5db943becde127bc05c2a74300ae6f9 (patch)
treeceb4a27d73a2be4c42510a11b310152fca7ca699 /nixos
parentf1c559057eae5dbf20b8948c50c270207acd2067 (diff)
downloadnixpkgs-c957341ef5db943becde127bc05c2a74300ae6f9.tar
nixpkgs-c957341ef5db943becde127bc05c2a74300ae6f9.tar.gz
nixpkgs-c957341ef5db943becde127bc05c2a74300ae6f9.tar.bz2
nixpkgs-c957341ef5db943becde127bc05c2a74300ae6f9.tar.lz
nixpkgs-c957341ef5db943becde127bc05c2a74300ae6f9.tar.xz
nixpkgs-c957341ef5db943becde127bc05c2a74300ae6f9.tar.zst
nixpkgs-c957341ef5db943becde127bc05c2a74300ae6f9.zip
nixos-container: allow setting custom local and host address
I have a nixops network where I deploy containers using the `container`
backend which uses `nixos-container` intenrally to deploy several
containers to a certain host.

During that time I removed and added new containers and while trying to
deploy those to a different host I realized that it isn't guaranteed
that each container gets the same IP address which is a problem as some
parts of the deployment need to know which container is using which IP
(i.e. to configure port forwarding on the host).

With this change you can specify the container's IP like this (and don't
have to use the arbitrarily used 10.233.0.0/16 subnet):

```
$ nixos-container create test --config-file test-container.nix \
    --local-address 10.235.1.2 --host-address 10.235.1.1
```
Diffstat (limited to 'nixos')
-rw-r--r--nixos/doc/manual/administration/imperative-containers.xml7
1 files changed, 7 insertions, 0 deletions
diff --git a/nixos/doc/manual/administration/imperative-containers.xml b/nixos/doc/manual/administration/imperative-containers.xml
index 9bb62bc2ece..7ded0c11786 100644
--- a/nixos/doc/manual/administration/imperative-containers.xml
+++ b/nixos/doc/manual/administration/imperative-containers.xml
@@ -30,6 +30,13 @@
   <link linkend="opt-users.users._name__.openssh.authorizedKeys.keys">users.users.root.openssh.authorizedKeys.keys</link> = ["ssh-dss AAAAB3N…"];
 '
 </screen>
+  By default the next free address in the <literal>10.233.0.0/16</literal> subnet will be chosen
+  as container IP. This behavior can be altered by setting <literal>--host-address</literal> and
+  <literal>--local-address</literal>:
+<screen>
+# nixos-container create test --config-file test-container.nix \
+    --local-address 10.235.1.2 --host-address 10.235.1.1
+</screen>
  </para>
 
  <para>