mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 05:00:16 +00:00
dockerTools.streamLayeredImage: Add test for fakeRootCommands
This commit is contained in:
parent
c420e650c9
commit
63e7c4186f
|
@ -270,5 +270,13 @@ import ./make-test-python.nix ({ pkgs, ... }: {
|
|||
docker.succeed(
|
||||
"docker images --format '{{.Repository}}' | grep -F '${examples.prefixedLayeredImage.imageName}'"
|
||||
)
|
||||
|
||||
with subtest("buildLayeredImage supports running chown with fakeRootCommands"):
|
||||
docker.succeed(
|
||||
"docker load --input='${examples.layeredImageWithFakeRootCommands}'"
|
||||
)
|
||||
docker.succeed(
|
||||
"docker run --rm ${examples.layeredImageWithFakeRootCommands.imageName} sh -c 'stat -c '%u' /home/jane | grep -E ^1000$'"
|
||||
)
|
||||
'';
|
||||
})
|
||||
|
|
|
@ -441,4 +441,17 @@ rec {
|
|||
tag = "latest";
|
||||
config.Cmd = [ "${pkgs.hello}/bin/hello" ];
|
||||
};
|
||||
|
||||
# layered image with files owned by a user other than root
|
||||
layeredImageWithFakeRootCommands = pkgs.dockerTools.buildLayeredImage {
|
||||
name = "layered-image-with-fake-root-commands";
|
||||
tag = "latest";
|
||||
contents = [
|
||||
pkgs.pkgsStatic.busybox
|
||||
];
|
||||
fakeRootCommands = ''
|
||||
mkdir -p ./home/jane
|
||||
chown 1000 ./home/jane
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue