docker: Minor improvements, fix failing test

- Replace usage of deprecated CLI flag `--daemon`
- Introduce `storageDriver` option for module
- Fix failing test by using `overlay` storage driver
This commit is contained in:
Ragnar Dahlén 2015-09-04 00:18:19 +01:00
parent 66429fa043
commit 9bfe92ecee
2 changed files with 14 additions and 2 deletions

View file

@ -43,6 +43,17 @@ in
in future. So set this option explicitly to false if you wish.
'';
};
storageDriver =
mkOption {
type = types.enum ["aufs" "btrfs" "devicemapper" "overlay" "zfs"];
description =
''
This option determines which Docker storage driver to use.
It is required but lacks a default value as its most
suitable value will depend the filesystems available on the
host.
'';
};
extraOptions =
mkOption {
type = types.separatedString " ";
@ -85,7 +96,7 @@ in
after = [ "network.target" "docker.socket" ];
requires = [ "docker.socket" ];
serviceConfig = {
ExecStart = "${pkgs.docker}/bin/docker --daemon=true --host=fd:// --group=docker ${cfg.extraOptions}";
ExecStart = "${pkgs.docker}/bin/docker daemon --host=fd:// --group=docker --storage-driver=${cfg.storageDriver} ${cfg.extraOptions}";
# I'm not sure if that limits aren't too high, but it's what
# goes in config bundled with docker itself
LimitNOFILE = 1048576;
@ -111,7 +122,7 @@ in
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
ExecStart = "${pkgs.docker}/bin/docker --daemon=true --group=docker ${cfg.extraOptions}";
ExecStart = "${pkgs.docker}/bin/docker daemon --group=docker --storage-driver=${cfg.storageDriver} ${cfg.extraOptions}";
# I'm not sure if that limits aren't too high, but it's what
# goes in config bundled with docker itself
LimitNOFILE = 1048576;

View file

@ -11,6 +11,7 @@ import ./make-test.nix ({ pkgs, ...} : {
{ config, pkgs, ... }:
{
virtualisation.docker.enable = true;
virtualisation.docker.storageDriver = "overlay";
};
};