From d04bdce3d1690f41667125995efcf310d936b3bf Mon Sep 17 00:00:00 2001 From: Benjamin Staffin <benley@gmail.com> Date: Wed, 5 Feb 2020 16:30:31 -0500 Subject: [PATCH] docker-containers: Don't unconditionally prune images (#79253) NixOS has `virtualisation.docker.autoPrune.enable` for this functionality; we should not do it every time a container starts up. (also, some trivial documentation fixes) --- nixos/modules/virtualisation/docker-containers.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nixos/modules/virtualisation/docker-containers.nix b/nixos/modules/virtualisation/docker-containers.nix index 3a2eb97d1bf..216ba2c733f 100644 --- a/nixos/modules/virtualisation/docker-containers.nix +++ b/nixos/modules/virtualisation/docker-containers.nix @@ -39,7 +39,7 @@ let entrypoint = mkOption { type = with types; nullOr str; - description = "Overwrite the default entrypoint of the image."; + description = "Override the default entrypoint of the image."; default = null; example = "/bin/my-app"; }; @@ -145,7 +145,7 @@ let Note that this is a list of <literal>"src:dst"</literal> strings to allow for <literal>src</literal> to refer to - <literal>/nix/store</literal> paths, which would difficult with an + <literal>/nix/store</literal> paths, which would be difficult with an attribute set. There are also a variety of mount options available as a third field; please refer to the <link xlink:href="https://docs.docker.com/engine/reference/run/#volume-shared-filesystems"> @@ -220,10 +220,9 @@ let ++ map escapeShellArg container.cmd ); - ExecStartPre = ["-${pkgs.docker}/bin/docker rm -f ${name}" - "-${pkgs.docker}/bin/docker image prune -f"] ++ - (optional (container.imageFile != null) - ["${pkgs.docker}/bin/docker load -i ${container.imageFile}"]); + ExecStartPre = + ["-${pkgs.docker}/bin/docker rm -f ${name}"] ++ + (optional (container.imageFile != null) "${pkgs.docker}/bin/docker load -i ${container.imageFile}"); ExecStop = ''${pkgs.bash}/bin/sh -c "[ $SERVICE_RESULT = success ] || ${pkgs.docker}/bin/docker stop ${name}"''; ExecStopPost = "-${pkgs.docker}/bin/docker rm -f ${name}";