docker-tools: add example for exportImage functionality and test

This commit is contained in:
Justin Bedo 2021-05-08 21:49:39 +10:00
parent 895f3956d2
commit 0319228a45
No known key found for this signature in database
GPG Key ID: 2C18202C56C182BD
2 changed files with 8 additions and 0 deletions

View File

@ -378,5 +378,10 @@ import ./make-test-python.nix ({ pkgs, ... }: {
docker.succeed(
"docker run --rm ${examples.layeredImageWithFakeRootCommands.imageName} sh -c 'stat -c '%u' /home/jane | grep -E ^1000$'"
)
with subtest("exportImage produces a valid tarball"):
docker.succeed(
"tar -tf ${examples.exportBash} > /dev/null"
)
'';
})

View File

@ -541,4 +541,7 @@ rec {
config.Cmd = [ "hello" ];
includeStorePaths = false;
};
# Example export of the bash image
exportBash = pkgs.dockerTools.exportImage { fromImage = bash; };
}