Bioconductor / bioc_docker

[DEPRECATED] Docker containers for Bioconductor
https://github.com/bioconductor/bioconductor_docker
Artistic License 2.0
49 stars 27 forks source link

Mounted volume for site library #65

Closed lwaldron closed 5 years ago

lwaldron commented 5 years ago

A problem with using the Docker images for day-to-day work is that installed packages disappear whenever you restart the container. I have worked around this by mounting a volume like this in the docker run statement:

      -v /Users/lwaldron/docker-devel-packages:/usr/local/lib/R/host-site-library

Then from within the container rstudio prompt:

.libPaths(c("/usr/local/lib/R/host-site-library", .libPaths())

I have to enter this latter command in every new R session, because I find that docker run flags like:

      -e R_LIBS_USER='/usr/local/lib/R/host-site-library:/usr/local/lib/R/site-library'

have no effect on .libPaths(). The existing .libPaths() directories already contain packages, so if I mount them to a host volume I lose the packages already installed.

Could the Bioconductor Docker containers add a /usr/local/lib/R/host-site-library to the .libPaths(), to facilitate users who would like to keep a persistent host package directory rather than re-installing them with each docker run?

lwaldron commented 5 years ago

As an additional note, setting R_LIBS_USER as above does set the environment variable when accessing the container through a shell, but not for RStudio as shown by Sys.getenv() or the RStudio terminal or .libPaths(). Probably something to do with this (https://support.rstudio.com/hc/en-us/articles/115014830827-Why-is-libPaths-different-in-RStudio-vs-R-) although I couldn't see in any of those listed places either where R_LIBS_USER is over-ridden within RStudio.

lwaldron commented 5 years ago

FYI I've drafted a working Docker image to make running locally easier by adding a /usr/local/lib/R/host-site-library and providing a convenience invocation script which also mounts the home directory onto a host volume, at https://github.com/waldronlab/bioconductor_devel, and Dockerhub waldronlab/bioconductor_devel. Once I add an equivalent release image, the idea is that you just run bioconductor release or bioconductor devel on the command line to get a running container with mounted package directory and home directory. Feedback welcomed.

lshep commented 5 years ago

We are looking into this -

lshep commented 5 years ago

I've added /usr/local/lib/R/host-site-library to the .libPaths - I have to rebuild the images for it to be active - however when I make the commit it will close the issue as I'm tagging the issue number - please don't expect it to be active until I respond back that I have rebuilt the images on dockerhub. After I rebuild, I will test and either reopen if it need further work or comment that the tests are successful. Cheers.

lshep commented 5 years ago

If this is successful I will also update the README and the Bioconductor websites docker help page to reflect as an option

lshep commented 5 years ago

This should be good to go - the bioconductor devel and release dockers have been rebuilt for base and core - I updated to include this information in the README and website help page. If you think there is better wording let me know or submit a pull request. I'm still trying to rebuild the contributed dockers although some of these had issues before this so it may or may not be available for them.

lshep commented 5 years ago

Nitesh pointed out the bug of the Rprofile not being recognized by Rstudio and needing to be in the rstudio directory - I added this and am rebuilding ...