Closed nsheff closed 4 years ago
Hi @nsheff ,
Can you please give me an example of what you are trying to do?
Because after investigating the rocker/r-ver image, it seems like that path R_LIBS_USER
is getting reset anyway, https://github.com/rocker-org/rocker-versioned/blob/master/r-ver/devel/Dockerfile#L117. The bioconductor/devel_base2 image inherits from rocker/rstudio which inherits from rocker/r-ver:devel.
As you can see, in the code below, which is the base rocker/r-ver:devel image, the R_LIBS_USER location is reset anyway.
> Sys.getenv("R_LIBS")
[1] "/usr/local/lib/R/site-library:/usr/local/lib/R/library:/usr/lib/R/library"
> Sys.getenv("R_LIBS_USER")
[1] "/usr/local/lib/R/site-library"
Could you help me figure out what is the use case for this?
Are you trying the docker image with an environment variable set like ?
docker run -it -e R_LIBS_USER=/<path> <image> bash
or maybe attaching a volume with ?
docker run -v /tmp:/usr/local/lib/R/host-site-library -it <image> bash
We think the motivation for setting R_LIBS_USER='' is that by setting R_LIBS the rocker/r-ver has kind of 'spoiled' things anyway -- R_LIBS always occurs before R_LIBS_USER in .libPaths()
~ ❯❯❯ R_LIBS_USER=/tmp R_LIBS=/tmp/cvcd R --silent -e ".libPaths()"
> .libPaths()
[1] "/private/tmp/cvcd"
[2] "/private/tmp"
[3] "/Users/ni41435_lca/R-stuff/bin/R-devel/library"
In an interactive session one could use .libPaths(c("/my/path", .libPaths())
; this could be set programmatically in a derived docker container in ~/.Rprofile, even using a custom environment variable R_LIBS_NATHANS=...
, but this is probably too much of a hack...
Also take a look at #95, if nothing else, this should fix the issue.
See also:
https://github.com/rocker-org/rocker-versioned/issues/175 https://github.com/rocker-org/rocker-versioned/pull/176 https://github.com/rocker-org/rocker-versioned/pull/186
Indeed, the same problem shows up in the rocker files... but it appears this is being addressed, so the solution should also be propagated through the bioconductor files.
What I am trying to do is simply something like you suggest:
docker run -it -e R_LIBS_USER=/<path> <image> R
I just want the containerized R to pick up R_LIBS_USER the same way an uncontainerized R would.
It looks like you may have solved this in bdf7866bdb13fa47ef4b25c122a9add8dfccd755
Great! I'm going to close this issue then @nsheff
Several of these dockerfiles are overriding the R_LIBS_USER variable by forcing it to
''
in the.Renviron
file:https://github.com/Bioconductor/bioc_docker/blob/8d2a26f1127caae86a44a3105e2ace68900cc229/out/release_base/Dockerfile#L42
This causes a problem in that the R_LIBS_USER variable is suppressed. So, users using the container and expecting to be able to add a user-specific library cannot do so.
Is there a suggested way to use these images with R_LIBS_USER? If not, I suggest not overriding this value, because there is no way for the user to undo this and get the default functionality back.