Consider the exit status of docker run in ExecStop (#76444)

We don't need to stop the container if it already exited sucessfully
This commit is contained in:
Atemu 2020-01-02 00:28:46 +01:00 committed by Benjamin Staffin
parent f4375dd320
commit a461f3fa9c

View File

@ -186,7 +186,7 @@ let
++ map escapeShellArg container.cmd ++ map escapeShellArg container.cmd
); );
ExecStartPre = "-${pkgs.docker}/bin/docker rm -f %n"; 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"; ExecStopPost = "-${pkgs.docker}/bin/docker rm -f %n";
### There is no generalized way of supporting `reload` for docker ### There is no generalized way of supporting `reload` for docker