How I use Bioconductor with Docker

Nitesh Turaga
2 min readJun 30, 2019

--

Github: nturaga , twitter: niteshturaga

This is how I use the image, bioconductor/bioconductor_full:devel in my daily use. I use this particular image because it has all the system dependencies to install most Bioconductor packages.

docker pull bioconductor/bioconductor_full:devel

Start up the docker image, and share a folder for the library-store and also the data-store.

docker run -d \
-v /shared/data-store:/home/rstudio/data \
-v /shared/library-store:/usr/local/lib/R/host-site-library \
-e PASSWORD=bioc \
-p 8787:8787 \
bioconductor/bioconductor_full:devel

RStudio gets started(username: rstudio, password: bioc) at the url, http://localhost:8787 in a detached state with the -d flag (Run container in background and print container ID). I don’t like having to keep starting and stopping the image each time.

$ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
00e1d3e4a97a bioconductor/bioconductor_full:devel “/init” About a minute ago Up About a minute 0.0.0.0:8787->8787/tcp affectionate_kirch

I store all my data and analysis results in the folder, /home/rstudio/data.

When I install new packages, they get compiled using the R inside the container, but are stored in the path /usr/local/lib/R/host-site-library. As shown below, this path is first one searched for libraries installed.

> .libPaths()
[1] "/usr/local/lib/R/host-site-library" "/usr/local/lib/R/site-library"
[3] "/usr/local/lib/R/library"

This allows my image to remain as published by Bioconductor, with a few advantages,

  1. The size of the image stays the same.
  2. I never have to worry about updating the image, that is left to the maintainers.
  3. Never have to worry about system dependencies.

If I do ever want to kill my container,

docker kill 00e1d3e4a97a

Next: How I use Bioconductor with Docker (part 2): More memory, faster Bioconductor with Docker

--

--