I use RStudio in Docker container in Windows 10 Pro.
I use RStudio rocker/rstudio
image pulled from https://hub.docker.com/u/rocker/.
To start container I executed command:
docker run -d -p 8787:8787 -v //c/Users/<My name>/Documents/R/Rprojects:/home/rstudio/ rocker/rstudio
And then I can access the server from my browser by following link: http://localhost:8787/. Everything works fine.
What I want to do is some customization of the RStudio environment. In particular, I changed Tools/Global options/Editor theme to 'Pastel on Dark'. I applied this option but it persists only when the container alive. When I restart the container custom options are all gone.
My projects are saved in the folder that I indicated when running container, but global options are not.
So, how can I save also global options on my hard drive. Maybe I need to expose another folder on my drive which will connect to container folder where RStudio saves global options?
Is it possible to predefine global options in dockerfile
as a new layer in docker image?
If, like me, you use an ephemeral container (using the
--rm
flag), then the container gets deleted when stopped. This is a good thing as it ensures a 100% clean environment every time but it means settings are not preserved from session to session.Unlike many popular IDE, rstudio settings are not stored in a user-accessible transparent json, although they are working on it.
A workaround is copying over the settings to the right location:
/home/rstudio/.R/rstudio/keybindings/rstudio_bindings.json
/home/rstudio/.rstudio/monitored/user-settings
To set it up:
I have created a quick launch shortcut pointing to the following script which is easily adapted. It starts a container named rstudio and copies over the settings I have backed up (in my case from
/home/asac/projects/rstudio-config
)To clear up Alexander's comment on his own post:
(*whichever recent item of step 4 has image rocker/verse)
Thanks, Alexander