summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nixos/tests/docker-tools.nix5
-rw-r--r--pkgs/build-support/docker/examples.nix3
2 files changed, 8 insertions, 0 deletions
diff --git a/nixos/tests/docker-tools.nix b/nixos/tests/docker-tools.nix
index 4c3c26980aa..1f0088d63fd 100644
--- a/nixos/tests/docker-tools.nix
+++ b/nixos/tests/docker-tools.nix
@@ -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"
+        )
   '';
 })
diff --git a/pkgs/build-support/docker/examples.nix b/pkgs/build-support/docker/examples.nix
index c66aca56fea..6ec25711dd1 100644
--- a/pkgs/build-support/docker/examples.nix
+++ b/pkgs/build-support/docker/examples.nix
@@ -541,4 +541,7 @@ rec {
     config.Cmd = [ "hello" ];
     includeStorePaths = false;
   };
+
+  # Example export of the bash image
+  exportBash = pkgs.dockerTools.exportImage { fromImage = bash; };
 }