Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ZhoraGrig opened this issue Apr 24, 2024 · 1 comment

Comments

@ZhoraGrig
Copy link

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

@simarmannsingh
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants