dockerTools.tests.docker-tools: Add non-root streamLayeredImage test
This commit is contained in:
parent
b2f19980db
commit
4733b52c6b
1 changed files with 20 additions and 0 deletions
|
@ -58,6 +58,20 @@ let
|
||||||
'';
|
'';
|
||||||
config.Cmd = [ "${pkgs.coreutils}/bin/stat" "-c" "%u:%g" "/testfile" ];
|
config.Cmd = [ "${pkgs.coreutils}/bin/stat" "-c" "%u:%g" "/testfile" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nonRootTestImage =
|
||||||
|
pkgs.dockerTools.streamLayeredImage rec {
|
||||||
|
name = "non-root-test";
|
||||||
|
tag = "latest";
|
||||||
|
uid = 1000;
|
||||||
|
gid = 1000;
|
||||||
|
uname = "user";
|
||||||
|
gname = "user";
|
||||||
|
config = {
|
||||||
|
User = "user";
|
||||||
|
Cmd = [ "${pkgs.coreutils}/bin/stat" "-c" "%u:%g" "${pkgs.coreutils}/bin/stat" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
name = "docker-tools";
|
name = "docker-tools";
|
||||||
meta = with pkgs.lib.maintainers; {
|
meta = with pkgs.lib.maintainers; {
|
||||||
|
@ -604,5 +618,11 @@ in {
|
||||||
"${chownTestImage} | docker load",
|
"${chownTestImage} | docker load",
|
||||||
"docker run --rm ${chownTestImage.imageName} | diff /dev/stdin <(echo 12345:12345)"
|
"docker run --rm ${chownTestImage.imageName} | diff /dev/stdin <(echo 12345:12345)"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
with subtest("streamLayeredImage: with non-root user"):
|
||||||
|
docker.succeed(
|
||||||
|
"${nonRootTestImage} | docker load",
|
||||||
|
"docker run --rm ${chownTestImage.imageName} | diff /dev/stdin <(echo 12345:12345)"
|
||||||
|
)
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue