Home > Blockchain >  Schedule daily Docker container restart / reset
Schedule daily Docker container restart / reset

Time:09-24

I have a Linux based Docker container running an application which seems to have a memory leak. After around a week requests to the application start to fail and the container requires a restart to reset its state and get things working again.

The error reported by the application is:

java.lang.OutOfMemoryError: Java heap space

Is there a generic method that can be used to trigger a restart, resetting it's state, regardless of which service is being used to host it? If there's not a good generic solution, I'm about to give DigitalOcean a whirl so maybe there's a DigitalOcean specific solution that may work instead?

CodePudding user response:

You can set a restart policy (with flag on-failure) as described here.

CodePudding user response:

Check out the Watchtower project. This is an incredible tool that restarts Docker containers on schedule and also updates containers automatically.

  • Related