I'm running Rstudio (preview) in a Docker container on macOS and Windows. I'm using a bash script to make it easier to start/stop the container. This is working very nicely, except that each time I stop (kill) the docker process and start it back up again, Rstudio shows an error message that the "session was abnormally terminated" and the pervious workspace/environment is not restored.
Is there a way to avoid this message from showing up and restoring the previous workspace from the mounted volume? I expect that Rstudio is not storing sessions on SIGTERM. Is there a way to enforce that?
EDIT: Perhaps a related issue. When trying to suspend-all rstudio processes running in a docker container the first command below suggests that this might work. However, the 2nd gives "rsession" no process found
Thanks @jonathan. I did try that but couldn't get it to work from a script running on macOS for some reason (message was "no rsession"). However, the following did work:
running=$(docker ps -q)
if [ "${running}" != "" ]; then
echo "Stopping running containers ..."
suspend_sessions () {
active_session=$(docker exec -t $1 rstudio-server active-sessions | awk '/[0-9]+/ { print $1}')
if [ "${active_session}" != "" ]; then
docker exec -t $1 rstudio-server suspend-session ${active_session}
fi
}
for index in ${running}; do
suspend_sessions $index
done
docker stop ${running}
fi
EDIT: Some more specifics about what I see when I try force-suspend-all. First, active-session suggests I am connecting to the running container. However, when using force-suspend-all I get the error shown below.
$ docker exec -t a8cec684bbbd rstudio-server active-sessions
PID TIME COMMAND
91 00:00:04 /usr/lib/rstudio-server/bin/rsession -u jovyan --launcher-token F
$ docker exec -t a8cec684bbbd rstudio-server force-suspend-all
rsession: no process found