summary refs log tree commit diff
path: root/nixos/modules/virtualisation/containers.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-03-17 14:04:39 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-03-17 14:10:47 +0100
commit0d506aa712cf088343dff5863e9e58eb1228c3b0 (patch)
tree143c15a622b59b319d9d14e0a2db2f5182197d2f /nixos/modules/virtualisation/containers.nix
parent1b6c01721d3853860903a605575b8eddd56c2db1 (diff)
downloadnixpkgs-0d506aa712cf088343dff5863e9e58eb1228c3b0.tar
nixpkgs-0d506aa712cf088343dff5863e9e58eb1228c3b0.tar.gz
nixpkgs-0d506aa712cf088343dff5863e9e58eb1228c3b0.tar.bz2
nixpkgs-0d506aa712cf088343dff5863e9e58eb1228c3b0.tar.lz
nixpkgs-0d506aa712cf088343dff5863e9e58eb1228c3b0.tar.xz
nixpkgs-0d506aa712cf088343dff5863e9e58eb1228c3b0.tar.zst
nixpkgs-0d506aa712cf088343dff5863e9e58eb1228c3b0.zip
Provide a simple way to log into containers
On the host, you can run

  $ socat unix:<path-to-container>/var/lib/login.socket -,echo=0,raw

to get a login prompt.  So this allows logging in even if the
container has no SSH access enabled.

You can also do

  $ socat unix:<path-to-container>/var/lib/root-shell.socket -

to get a plain root shell.  (This socket is only accessible by root,
obviously.)  This makes it easy to execute commands in the container,
e.g.

  $ echo reboot | socat unix:<path-to-container>/var/lib/root-shell.socket -
Diffstat (limited to 'nixos/modules/virtualisation/containers.nix')
-rw-r--r--nixos/modules/virtualisation/containers.nix1
1 files changed, 1 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix
index d87284de4fc..f1fcc18f1f9 100644
--- a/nixos/modules/virtualisation/containers.nix
+++ b/nixos/modules/virtualisation/containers.nix
@@ -57,6 +57,7 @@ with pkgs.lib;
                       { boot.isContainer = true;
                         security.initialRootPassword = mkDefault "!";
                         networking.hostName = mkDefault name;
+                        imports = [ ./container-login.nix ];
                       };
                     in [ extraConfig config.config ];
                   prefix = [ "systemd" "containers" name ];