Restarting Rstudio Server in Docker: Avoid Error Message - Follow up

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?

FYI This is a follow up to Restarting Rstudio Server in Docker: Avoid Error Message

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

$ docker exec -it 76fe4bbf8716 rstudio-server
$Usage: rstudio-server {status|start|stop|restart|test-config|verify-installation|suspend-session|suspend-all|force-suspend-session|force-suspend-all|kill-session|kill-all|offline|online|active-sessions|version}

$ docker exec -it 76fe4bbf8716 rstudio-server suspend-all
rsession: no process found

If you want to preserve the workspace, run rstudio-server force-suspend-all before shutting down. See Redirect.

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

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.