rwynn / monstache

a go daemon that syncs MongoDB to Elasticsearch in realtime. you know, for search.

Home Page:https://rwynn.github.io/monstache-site/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker container exits without error after 5 days despite restart=always

ZhoraGrig opened this issue · comments

After running a Docker container with the restart=always policy, the container unexpectedly exits without any visible error messages after approximately 5 days of continuous operation. This behavior occurs consistently and is causing disruptions to the application's availability.

Command

docker run -d --name monstache --restart always -v $(pwd)/monstache:/monstache -p 8089:8080 -w /monstache rwynn/monstache:latest -f ./config.toml

The issue could be that you are running the docker commands under a rootless docker context that you run from your own user.
If that is the case, systemd might be the culprit. systemd kills processes started under a user automatically after a certain amount of time when the user session ends.

To fix this, Enable linger mode or configure systemd to not kill user processes, or both.

sudo loginctl enable-linger $USER

Just to be sure, edit /etc/systemd/logind.conf and add the following lines to the end. (These might already exist, just uncomment them)

UserStopDelaySec=infinity
KillUserProcesses=no

Reboot your machine for the new config to take effect.

sudo reboot