Navigation Menu

Skip to content

Commit

Permalink
docker-tools: add example for exportImage functionality and test
Browse files Browse the repository at this point in the history
  • Loading branch information
jbedo committed Sep 29, 2021
1 parent 895f395 commit 0319228
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nixos/tests/docker-tools.nix
Expand Up @@ -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"
)
'';
})
3 changes: 3 additions & 0 deletions pkgs/build-support/docker/examples.nix
Expand Up @@ -541,4 +541,7 @@ rec {
config.Cmd = [ "hello" ];
includeStorePaths = false;
};

# Example export of the bash image
exportBash = pkgs.dockerTools.exportImage { fromImage = bash; };
}

0 comments on commit 0319228

Please sign in to comment.