database not stored on docker-image with shinyproxy database not stored on docker-image with shinyproxy sqlite sqlite

database not stored on docker-image with shinyproxy


This is expected behavior. The SQLite DB is stored within the running container, not the image. It is therefore lost when the container is shut down. And shinyproxy starts a new container for every user. The general solution with docker is to use an external volume that is mounted into the running container and use that file/directory to store persistent data. Together with shinyproxy, you have to use docker-volumes, c.f. https://www.shinyproxy.io/configuration/#apps.

Putting this together you can use in the shinyproxy config something like:

apps:  - name: ...    docker-cmd: ...    docker-image: ...    docker-volumes: /some/local/path/:/mnt/persistent

And in the shiny app something like:

dbConnect(RSQLite::SQLite(), "/mnt/persistent/my-db.sqlite")