forked from mirrors/nixpkgs
docker: test for socket permissions
This commit is contained in:
parent
fa4fe71105
commit
c7453084ef
|
@ -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");
|
||||
'';
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue