summary refs log tree commit diff
path: root/nixos/modules/virtualisation
diff options
context:
space:
mode:
authorAtemu <atemu.main@gmail.com>2020-01-02 00:28:46 +0100
committerBenjamin Staffin <benley@gmail.com>2020-01-01 18:28:46 -0500
commita461f3fa9c44b892d798a3c935e7816d26f45f11 (patch)
treeb27e0f532e2a5928e03849e59aa5f4ac1e6b914b /nixos/modules/virtualisation
parentf4375dd320cda42eae1d721653e673a7ed123317 (diff)
Consider the exit status of docker run in ExecStop (#76444)
We don't need to stop the container if it already exited sucessfully
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r--nixos/modules/virtualisation/docker-containers.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/nixos/modules/virtualisation/docker-containers.nix b/nixos/modules/virtualisation/docker-containers.nix
index 59b0943f591f1..760cb9122a2f5 100644
--- a/nixos/modules/virtualisation/docker-containers.nix
+++ b/nixos/modules/virtualisation/docker-containers.nix
@@ -186,7 +186,7 @@ let
         ++ map escapeShellArg container.cmd
       );
       ExecStartPre = "-${pkgs.docker}/bin/docker rm -f %n";
-      ExecStop = "${pkgs.docker}/bin/docker stop %n";
+      ExecStop = ''${pkgs.bash}/bin/sh -c "[ $SERVICE_RESULT = success ] || ${pkgs.docker}/bin/docker stop %n"'';
       ExecStopPost = "-${pkgs.docker}/bin/docker rm -f %n";
 
       ### There is no generalized way of supporting `reload` for docker