Skip to content

Commit

Permalink
docker-containers: Don't unconditionally prune images (#79253)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
benley committed Feb 5, 2020
1 parent 348025b commit d04bdce
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions nixos/modules/virtualisation/docker-containers.nix
Expand Up @@ -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";
};
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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}";
Expand Down

0 comments on commit d04bdce

Please sign in to comment.