I’m running the “earxng/searxng:latest” docker container with:
virtualisation = { # {{{
oci-containers.backend = "docker";
oci-containers.containers = {
SearxNG = {
image = "searxng/searxng:latest";
# extraOptions = [ "--restart=unless-stopped" ];
# autoStart = true;
ports = [ "8888:8080" ];
environment = {
BASE_URL = "http://localhost:8888";
INSTANCE_NAME = "aLaptop SearxNG";
};
volumes = [
"/etc/nixos/SearxNG.yml:/etc/searxng/settings.yml"
];
};
};
}; # }}}
My problem is that the systemd service won’t stop and has to get timed out after 120 seconds. The generated systemd service is:
# /etc/systemd/system/docker-SearxNG.service
[Unit]
After=docker.service docker.socket network-online.target
[Service]
Environment="LOCALE_ARCHIVE=/nix/store/ja7cry6cb9wwclhlphmffgg4fv0ky4cd-glibc-locales-2.37-8/lib/locale/locale-archive"
Environment="PATH=/nix/store/5a1ci2w8wi0y2hqy67y26fw3dpwv084x-docker-20.10.25/bin:/nix/store/j4fwy5gi1rdlrlbk2c0vnbs7fmlm60a7-coreutils-9.1/bin:/nix/store/x6rwgp1jl5sgzwbsaigqkdbdc7krzwj7-findutils-4.9.0/bin:/nix/store/8mzvz6kk57p9aqdk72pq1adsl38bkzi6-gnugrep-3.7/bin:/nix/store/vqj2w8rqghmmp4wkn9lkcym5kzlqk372-gnused-4.9/bin:/nix/store/rpagyb9792jx4f2hlqz9q0ld3frlzxq5-systemd-253.6/bin:/nix/store/5a1ci2w8wi0y2hqy67y26fw3dpwv084x-docker-20.10.25/sbin:/nix/store/j4fwy5gi1rdlrlbk2c0vnbs7fmlm60a7-coreutils-9.1/sbin:/nix/store/x6rwgp1jl5sgzwbsaigqkdbdc7krzwj7-findutils-4.9.0/sbin:/nix/store/8mzvz6kk57p9aqdk72pq1adsl38bkzi6-gnugrep-3.7/sbin:/nix/store/vqj2w8rqghmmp4wkn9lkcym5kzlqk372-gnused-4.9/sbin:/nix/store/rpagyb9792jx4f2hlqz9q0ld3frlzxq5-systemd-253.6/sbin"
Environment="TZDIR=/nix/store/3yx6fa7gxgp4p6d79skvscvdd21alclp-tzdata-2023c/share/zoneinfo"
ExecStart=/nix/store/m40skdan3bvk144sbgg3433wpsij8qwi-unit-script-docker-SearxNG-start/bin/docker-SearxNG-start
ExecStartPre=/nix/store/bai32b05cm11agal8pfm6nz803n9a9l3-unit-script-docker-SearxNG-pre-start/bin/docker-SearxNG-pre-start
ExecStop=/nix/store/w594a7gmbjznm3zzhjlyvxdb110yn41j-unit-script-docker-SearxNG-pre-stop/bin/docker-SearxNG-pre-stop
ExecStopPost=/nix/store/lwfzqlpzaiazwmxlsn1pz266fy62ibiv-unit-script-docker-SearxNG-post-stop/bin/docker-SearxNG-post-stop
Restart=always
TimeoutStartSec=0
TimeoutStopSec=120
If I run the ExecStop script it only runs for 10 seconds to stop the container, and ExecStopPost script runs in milliseconds to remove the container. However when systemd runs those two commands it takes 2 minutes.
I have tried:
- Switching from podman back end to the docker back end
- Adding the flag “–restart=unless-stopped”
- This had the unintended side effect of not auto starting the container so I added “autoStart = true” to the configuration.nix.
- Checking the service logs with
journalctl -u docker-SearxNG.service
when running SearxNG and nothing unusual was in there. - Checking the service logs with
journalctl -u docker-SearxNG.service
after stopping the service and the logs didn’t change from when it was running.
I don’t know what else to test or where to look to fix the issue, thanks for the help!