mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-10-30 14:11:21 +00:00
dockerTools.tests.docker-tools: Add non-root streamLayeredImage test
This commit is contained in:
parent
b2f19980db
commit
4733b52c6b
@ -58,6 +58,20 @@ let
|
||||
'';
|
||||
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 {
|
||||
name = "docker-tools";
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
@ -604,5 +618,11 @@ in {
|
||||
"${chownTestImage} | docker load",
|
||||
"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 New Issue
Block a user