Skip to content

Services don't cleanly stop on system shutdown #250

Open
@lilyhahn

Description

Hi,

I have a docker-compose set up as a system service.
It's part of a module that is imported into my main configuration.nix.

The relevant configuration looks like this:

virtualisation.arion = {
                backend = "docker";
                projects.myservice = {
                        serviceName = "myservice";
                        settings.services."myservice".service = {
                                image = "myservice:latest";
                                restart = "unless-stopped";
                        };
                };
};

When I shutdown the machine with shutdown -h now, systemd appears to successfully stop the service, but then the final stage of shutdown hangs, logging that it's waiting for node (the main process inside the container) to exit.

If I run systemctl stop myservice, then shutdown, everything stops cleanly.

I've found this issue in nix containers which appears similar (NixOS/nixpkgs#109695), but the suggested workaround is adding a script to stop the services, and I do see systemd running the stop jobs when I shutdown - for some reason they have different results when run manually before shutdown.

Any suggestions for how to solve this issue would be appreciated!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions