forked from mirrors/nixpkgs
Merge pull request #80204 from CRTified/fix/issue-76620
docker-containers: Move ExecStartPre/ExecStopPost to preStart/postStop
This commit is contained in:
commit
06d18a5737
|
@ -210,6 +210,15 @@ let
|
|||
wantedBy = [] ++ optional (container.autoStart) "multi-user.target";
|
||||
after = [ "docker.service" "docker.socket" ] ++ mkAfter;
|
||||
requires = after;
|
||||
path = [ pkgs.docker ];
|
||||
|
||||
preStart = ''
|
||||
docker rm -f ${name} || true
|
||||
${optionalString (container.imageFile != null) ''
|
||||
docker load -i ${container.imageFile}
|
||||
''}
|
||||
'';
|
||||
postStop = "docker rm -f ${name} || true";
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = concatStringsSep " \\\n " ([
|
||||
|
@ -229,12 +238,7 @@ let
|
|||
++ map escapeShellArg container.cmd
|
||||
);
|
||||
|
||||
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}";
|
||||
ExecStop = ''${pkgs.bash}/bin/sh -c "[ $SERVICE_RESULT = success ] || docker stop ${name}"'';
|
||||
|
||||
### There is no generalized way of supporting `reload` for docker
|
||||
### containers. Some containers may respond well to SIGHUP sent to their
|
||||
|
|
Loading…
Reference in a new issue