how to forward all OS enviroment variables to r-studio community server

Hi,

I try to configure RStudio server to run inside a docker container. the start and everything works fine, the only problem are the environment variables.
If I run Sys.getenv() with R inside of the docker I get the whole list of OS envs. If I run the same command with the same R binary in rstudio I only get a hand full of rstudio specific envs.
I know I can define single variables via Renviron.site, but that isnt usefull if some variables are defined dynamically at the start of the docker.

so my question is: how can I import/forward all environment variables from the operating system (ubuntu) to rstudio at the start of rstudio?

thank you very much!

I don't have an exact solution to your problem, but recently dealt with a related issue of forwarding environment variables from the HPC module command to rstudio server. I put my solution up as a gist. I wonder if you could adapt it to redirect printenv to a file, and then load that file in .Rprofile and call Sys.setenv for every line in it.

1 Like