rocker-org / rocker-versioned

Run current & prior versions of R using docker
https://hub.docker.com/r/rocker/r-ver
GNU General Public License v2.0
297 stars 169 forks source link

/etc/R or /R/etc ? #120

Closed MarkEdmondson1234 closed 5 years ago

MarkEdmondson1234 commented 5 years ago

I have this error on a copy-paste from the RStudio Dockerfile

/bin/sh: 1: cannot create /usr/local/lib/R/etc/Rprofile.site: Directory nonexistent

which stems from this part:

  && mkdir -p /etc/R \
  ## Write config files in $R_HOME/etc
  && echo '\n\
    \n# Configure httr to perform out-of-band authentication if HTTR_LOCALHOST \
    \n# is not set since a redirect to localhost may not work depending upon \
    \n# where this Docker container is running. \
    \nif(is.na(Sys.getenv("HTTR_LOCALHOST", unset=NA))) { \
    \n  options(httr_oob_default = TRUE) \
    \n}' >> /usr/local/lib/R/etc/Rprofile.site \
  && echo "PATH=${PATH}" >> /usr/local/lib/R/etc/Renviron \

...which I fixed by thinking perhaps the /usr/local/lib/R/etc/Renviron locations should be /etc/R/Renviron and /usr/local/lib/R/etc/Rprofile.site should be /etc/R/Rprofile.site? But I can't understand why this hasn't broken the normal RStudio builds, so perhaps I'm missing something from lack of unix file structure knowledge.

Am I missing perhaps a mkdir -p /usr/local/lib/R/etc/?

cboettig commented 5 years ago

I believe RStudio server copies the /usr/local/lib/R/etc/ (i.e. $R_HOME/etc) to /R/etc, so I tend to write them to /usr/local/lib/R/etc/ and things seem to work. (i.e. check out /etc/R once RStudio server starts up and I believe you'll see these lines there, even though in the Dockerfile they are going to $R_HOME/etc instead!) Haven't tracked down documentation of the RStudio behavior here. R help also documents the load order for these somewhere; irrc you can put things in either place if you're just running cli R and things just work, but for the rstudio-based images better to use $R_HOME/etc location in the Dockerfiles themselves.

(Not sure what you're doing to create this error, this stuff quoted here looks like it is from the RStudio Dockerfile which seems to continue building successfully each day with these instructions. https://hub.docker.com/r/rocker/rstudio). confusing stuff, re-open if this doesn't resolve things.

MarkEdmondson1234 commented 5 years ago

Cool thanks, for my own education now the rocker/ml image is up and running but good to know

cboettig commented 5 years ago

just a heads up I'm still money-ing around with the rocker/ml image a bit, partly so I can get a sensible tag scheme where we can support both different versions of cuda and different versions of R. There will still be a rocker/ml:latest that does something reasonable though (e.g. probably cuda 9.0 and latest R for now). thoughts on a sane way to do this are welcome