From 01a68479cc08d4f937a93c27f8f36e701e4bd435 Mon Sep 17 00:00:00 2001 From: Antoine Eiche Date: Thu, 30 Jan 2020 10:43:15 +0100 Subject: dockerTools.buildLayeredImage: assert maxLayers > 1 Since a layer is reserved for "customization", the image can not contains less than 2 layers. The user gets the following message at evaluation: nix-instantiate nixos/tests/docker-tools.nix trace: the maxLayers argument of dockerTools.buildLayeredImage function must be greather than 1 (current value: 1) --- pkgs/build-support/docker/default.nix | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pkgs') diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix index 9f831d48bfa..509b7e2a7e1 100644 --- a/pkgs/build-support/docker/default.nix +++ b/pkgs/build-support/docker/default.nix @@ -545,6 +545,9 @@ rec { # believe the actual maximum is 128. maxLayers ? 100 }: + assert + (lib.assertMsg (maxLayers > 1) + "the maxLayers argument of dockerTools.buildLayeredImage function must be greather than 1 (current value: ${toString maxLayers})"); let baseName = baseNameOf name; contentsEnv = symlinkJoin { -- cgit 1.4.1