summary refs log tree commit diff
path: root/nixos/tests/docker-tools.nix
diff options
context:
space:
mode:
authorLouis Blin <45168934+lbpdt@users.noreply.github.com>2021-03-09 18:32:54 +0000
committerLouis Blin <45168934+lbpdt@users.noreply.github.com>2021-03-10 17:44:24 +0000
commit419a4fa596577667271fcfc057bc9063ddbffe47 (patch)
treedb50ea83866e9229e0bd37b6cc4c4e5c0f84e533 /nixos/tests/docker-tools.nix
parent0124e874f62cb39dfde076b77eab8184dc1b622e (diff)
downloadnixpkgs-419a4fa596577667271fcfc057bc9063ddbffe47.tar
nixpkgs-419a4fa596577667271fcfc057bc9063ddbffe47.tar.gz
nixpkgs-419a4fa596577667271fcfc057bc9063ddbffe47.tar.bz2
nixpkgs-419a4fa596577667271fcfc057bc9063ddbffe47.tar.lz
nixpkgs-419a4fa596577667271fcfc057bc9063ddbffe47.tar.xz
nixpkgs-419a4fa596577667271fcfc057bc9063ddbffe47.tar.zst
nixpkgs-419a4fa596577667271fcfc057bc9063ddbffe47.zip
dockerTools.buildLayeredImage: image names with registry/ prefix
When using `buildLayeredImage`, it is not possible to specify an image
name of the form `<registry>/my/image`, although it is a valid name.

This is due to derivations under `buildLayeredImage` using that image
name as their derivation name, but slashes are not permitted in that
context.

A while ago, #13099 fixed that exact same problem in `buildImage` by
using `baseNameOf name` in derivation names instead of `name`. This
change does the same thing for `buildLayeredImage`.
Diffstat (limited to 'nixos/tests/docker-tools.nix')
-rw-r--r--nixos/tests/docker-tools.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/nixos/tests/docker-tools.nix b/nixos/tests/docker-tools.nix
index 6638ec4927c..1cc554d002b 100644
--- a/nixos/tests/docker-tools.nix
+++ b/nixos/tests/docker-tools.nix
@@ -254,5 +254,21 @@ import ./make-test-python.nix ({ pkgs, ... }: {
             "docker run --rm ${examples.layeredStoreSymlink.imageName} bash -c 'test -L ${examples.layeredStoreSymlink.passthru.symlink}'",
             "docker rmi ${examples.layeredStoreSymlink.imageName}",
         )
+
+    with subtest("buildImage supports registry/ prefix in image name"):
+        docker.succeed(
+            "docker load --input='${examples.prefixedImage}'"
+        )
+        docker.succeed(
+            "docker images --format '{{.Repository}}' | grep -F '${examples.prefixedImage.imageName}'"
+        )
+
+    with subtest("buildLayeredImage supports registry/ prefix in image name"):
+        docker.succeed(
+            "docker load --input='${examples.prefixedLayeredImage}'"
+        )
+        docker.succeed(
+            "docker images --format '{{.Repository}}' | grep -F '${examples.prefixedLayeredImage.imageName}'"
+        )
   '';
 })