Commit Graph

70 Commits

Author SHA1 Message Date
Arnold Krille
aa46904490 containers: Add a hostbridge and ipv6 addresses
This allows the containers to have their interface in a bridge on the host.
Also this adds IPv6 addresses to the containers both with bridged and unbridged
network.
2016-04-02 17:07:41 +02:00
Ian-Woo Kim
b3eebcd93c Merge branch 'master' into extra-binds 2015-09-28 06:02:52 +00:00
Ian-Woo Kim
c6b031d32b minor changes 2015-09-28 05:48:16 +00:00
Jan Malakhovski
6eadb16022 nixos: fix some types 2015-09-18 18:48:50 +00:00
Matthias Beyer
a38d9d1ca8 nixos-container: Add bash completion for "nixos-container" command 2015-09-16 22:18:48 +02:00
Luca Bruno
682777ed24 nixos containers: fix system path when reloading 2015-09-11 16:59:40 +02:00
Boris Sukholitko
ae80c3e7bc containers: fix interfaces option bugs
The default should be [], no need to check it for INTERFACES
variable.
2015-08-26 22:11:12 +03:00
Boris Sukholitko
77c49d9333 containers: add interfaces config option.
It uses systemd-nspawn's --network-interface to move
existing interfaces into the container.
2015-08-22 13:03:07 +03:00
Ian-Woo Kim
ae2279bcdb nixos-containers: bindMounts: change default to readOnly. use EXTRA_NSPAWN_FLAGS 2015-05-26 13:41:31 +00:00
Ian-Woo Kim
4d551227c9 nixos-container: rename extraBinds to bindMounts and use attribute set format. 2015-05-26 11:56:42 +00:00
Ian-Woo Kim
c4f66eb85d unify extraBindsRW/RO into extraBinds. Now arbitrary mount point is supported. 2015-05-25 19:09:53 +00:00
Ian-Woo Kim
cac38c8664 extraBindsRO/extraBindsRW 2015-05-24 16:31:59 +00:00
Eelco Dolstra
307064ceb5 Don't use machinectl to shut down containers
If the host is shutting down, machinectl may fail because it's
bus-activated and D-Bus will be shutting down. So just send a signal
to the leader process directly.

Fixes #6212.
2015-02-28 19:23:00 +01:00
Lane Seppala
4106a3b74e Fix rebooting containers where resolv.conf is a symlink 2015-02-27 10:27:18 -07:00
Eelco Dolstra
22d2fc3657 Fix "systemctl reload container@"
Fixes #5179.
2015-02-27 14:32:54 +01:00
Jaka Hudoklin
2af3ff52c2 nixos/containers: make containers in containers possible 2015-01-28 16:06:44 +01:00
Eelco Dolstra
3ca275d7ba NixOS containers: Create /root with 700 permission
Systemd-nspawn creates /root with 755 permission if it doesn't exist,
which is bad. So we have to create it ourselves before calling
systemd-nspawn.
2015-01-15 17:51:43 +01:00
mokasin
dd6dfde575 Add auto-start option to containers. 2015-01-12 18:26:22 +01:00
Aristid Breitkreuz
5ff169f4d7 containers: remove obsolete comment 2014-11-23 12:30:03 +01:00
Vladimír Čunát
d957b4bd78 Merge recent master into staging
Hydra nixpkgs: ?compare=1151601
2014-09-13 21:48:29 +02:00
Eelco Dolstra
152ae27aac Merge remote-tracking branch 'origin/systemd-216' into staging 2014-09-08 13:53:33 +02:00
Eelco Dolstra
3d821c068a Merge remote-tracking branch 'origin/master' into systemd-216 2014-09-02 14:43:27 +02:00
Vladimír Čunát
e51f73652d Merge recent master into staging
Hydra: ?compare=1149952

Conflicts:
	nixos/doc/manual/configuration.xml (changed split file)
	nixos/modules/config/users-groups.nix (choosing filterNull instead of inline definition)
	pkgs/development/libraries/readline/readline6.3.nix (auto-solved)
2014-08-30 10:04:02 +02:00
Eelco Dolstra
6773babd5b Containers: Use nsenter to execute commands in containers
Also remove ‘nixos-container set-root-password’, which is kind of
pointless now.
2014-08-28 02:20:23 +02:00
Eelco Dolstra
0263a8f860 NixOS containers: Use exit status 133 for reboots 2014-08-24 12:28:41 +02:00
Vladimír Čunát
d4e9fd2a90 Merge recent master into staging
Hydra: ?compare=1148749

Conflicts (easy):
	nixos/modules/virtualisation/containers.nix
2014-08-21 15:09:31 +02:00
Eelco Dolstra
23db49cf98 Containers: Fix all-containers.service start
Fixes #3662.
2014-08-19 10:06:48 +02:00
Eelco Dolstra
2c899859bf Containers: Use systemd startup notification
Systemd in a container will call sd_notify when it has finished
booting, so we can use that to signal that the container is
ready. This does require some fiddling with $NOTIFY_SOCKET.
2014-08-18 17:16:13 +02:00
Eelco Dolstra
11d99048c1 Containers: Use systemd-nspawn startup notification 2014-08-18 17:14:55 +02:00
Eelco Dolstra
ceb67cc9ef Containers: Clean up veth interfaces 2014-08-18 17:14:49 +02:00
Eelco Dolstra
32b977d4a7 Containers: Fix reboot and poweroff
Previously "machinectl reboot/poweroff" brutally killed the container,
as did "systemctl stop/restart". And reboot didn't actually work. Now
everything is fine.
2014-08-18 17:14:38 +02:00
Eelco Dolstra
2337a85fc3 Autostart containers at boot time 2014-08-18 17:09:42 +02:00
Eelco Dolstra
e620be97fe Containers: Set up /etc/resolv.conf
Systemd-nspawn is supposed to do this, but doesn't if any of the
--network-* flags are used.
2014-08-15 04:06:01 +02:00
Eelco Dolstra
330fadb706 Containers: Use systemd-nspawn startup notification
This prevents the container unit startup from hanging until timeout if
systemd-nspawn fails.
2014-08-13 00:49:25 +02:00
Eelco Dolstra
878b738333 Containers: Clean up veth interfaces 2014-08-12 03:13:32 +02:00
Eelco Dolstra
04ec038e89 Containers: Fix reboot and poweroff
Previously "machinectl reboot/poweroff" brutally killed the container,
as did "systemctl stop/restart". And reboot didn't actually work. Now
everything is fine.
2014-08-12 03:13:31 +02:00
Eelco Dolstra
4fc151b5a3 nixos-install: Ask the user to set a root password
This removes the need to have an initially empty root password.
2014-05-09 00:52:02 +02:00
Eelco Dolstra
333bfe16c4 Containers: Support setting up macvlan interfaces
By setting a line like

  MACVLANS="eno1"

in /etc/containers/<name>.conf, the container will get an Ethernet
interface named mv-eno1, which represents an additional MAC address on
the physical eno1 interface. Thus the container has direct access to
the physical network. You can specify multiple interfaces in MACVLANS.

Unfortunately, you can't do this with wireless interfaces.

Note that dhcpcd is disabled in containers by default, so you'll
probably want to set

  networking.useDHCP = true;

in the container, or configure a static IP address.

To do: add a containers.* option for this, and a flag for
"nixos-container create".
2014-05-07 17:53:57 +02:00
Eelco Dolstra
6f7aaf10a5 Containers: Use systemd-nspawn's --network-veth flag
Note that this causes the name of the host-side interface to change
from c-<name> to ve-<name>.
2014-05-07 17:53:57 +02:00
Eelco Dolstra
810680bcae Containers: Use systemd-nspawn's --keep-unit flag
This gets rid of some redundant scopes/slices.
2014-05-07 17:53:57 +02:00
Eelco Dolstra
b03a2f9e90 Set personality when running a 32-bit container on a 64-bit host 2014-04-19 13:14:51 +02:00
Eelco Dolstra
16bba2db2e Use "machinectl poweroff" to shut down containers 2014-04-18 17:11:59 +02:00
Eelco Dolstra
5fa812ba5e Containers: Inherit the platform type of the host
http://hydra.nixos.org/build/10350055
2014-04-15 12:58:42 +02:00
Eelco Dolstra
35bf0f4810 Don't restart container-startup-done 2014-04-15 12:07:24 +02:00
Eelco Dolstra
29027fd1e1 Rewrite ‘with pkgs.lib’ -> ‘with lib’
Using pkgs.lib on the spine of module evaluation is problematic
because the pkgs argument depends on the result of module
evaluation. To prevent an infinite recursion, pkgs and some of the
modules are evaluated twice, which is inefficient. Using ‘with lib’
prevents this problem.
2014-04-14 16:26:48 +02:00
Eelco Dolstra
6a7a8a144f Document NixOS containers 2014-04-10 15:07:29 +02:00
Eelco Dolstra
ac8c924c09 nixos-container: Add ‘run’ and ‘root-login’ commands
And remove ‘root-shell’.
2014-04-10 15:07:29 +02:00
Eelco Dolstra
3dca6b98cb Fix permissions on /var/lib/startup-done 2014-04-10 15:07:28 +02:00
Eelco Dolstra
b0b3fa928a Disable container support in containers
Systemd-nspawn doesn't support nesting, so providing nixos-container
inside a container doesn't make sense.
2014-04-03 16:36:23 +02:00
Eelco Dolstra
1ad9a654be Make starting a container synchronous
So now "systemctl start container@foo" will only return after the
container has reached multi-user.target.
2014-04-03 16:36:23 +02:00