3
0
Fork 0
forked from mirrors/nixpkgs

docker: test for socket permissions

This commit is contained in:
Graham Christensen 2017-04-03 09:05:15 -04:00
parent fa4fe71105
commit c7453084ef
No known key found for this signature in database
GPG key ID: 06121D366FE9435C

View file

@ -11,6 +11,21 @@ import ./make-test.nix ({ pkgs, ...} : {
{ config, pkgs, ... }:
{
virtualisation.docker.enable = true;
users.users = {
noprivs = {
isNormalUser = true;
description = "Can't access the docker daemon";
password = "foobar";
};
hasprivs = {
isNormalUser = true;
description = "Can access the docker daemon";
password = "foobar";
extraGroups = [ "docker" ];
};
};
};
};
@ -21,6 +36,8 @@ import ./make-test.nix ({ pkgs, ...} : {
$docker->succeed("tar cv --files-from /dev/null | docker import - scratchimg");
$docker->succeed("docker run -d --name=sleeping -v /nix/store:/nix/store -v /run/current-system/sw/bin:/bin scratchimg /bin/sleep 10");
$docker->succeed("docker ps | grep sleeping");
$docker->succeed("sudo -u hasprivs docker ps");
$docker->fail("sudo -u noprivs docker ps");
$docker->succeed("docker stop sleeping");
'';
})