R Shiny Application Running Inside Docker Dies/Becomes Grey After Less Than 1 Minute of Inactivity

I have an R Shiny application that is running inside a docker container. On my local Windows machine, when I start the Docker container/image, the container/shiny App starts and stay up and running without becoming grey/dying off.

However, when deployed to a server, the container starts, and the App runs fine. The problem is: the application, when accessed via web interface, it becomes grey after less than one minute of inactivity. The container is up but it is the application that keeps becoming grey after less than a minute. When one refreshes the browser, the app comes back to life quickly.

Can anyone who understands this tell me what I am missing in my container? Or what need to be done on the server?

Currently I have this inside my Docker file.

Expose port

EXPOSE 3838

Run app on container start

CMD [“R”, “-e”, “shiny::runApp(’/app2’, host = ‘0.0.0.0’, port = 3838)”]