Search
Question: how can I install packages in docker/R/bioconductor so that they persist?
1
gravatar for anton.kratz
2.0 years ago by
anton.kratz30
Japan
anton.kratz30 wrote:

I am using R/bioconductor under docker (mostly because it is much easier for me to install, and I want to enable future reproducibility by others).

I invoke R/bioconductor like this, so that I can access my local files from within it:

docker run -v $(pwd):/home/rstudio/$USER -p 8787:8787 bioconductor/devel_base

This is working great, but now I want to install an additional package (DESeq2). It installs fine, but everytime I restart the docker image, I need to install DESeq2 again! And it takes a long time to download and install.

Can I somehow install DESeq2 into the docker image of bioconductor/devel_base so that it does persist? I.e. I do not want to install it again every time I start the docker image. Or can I somehow save the docker image with the installed DESeq2 in it? Or what is the best approach?

ADD COMMENTlink written 2.0 years ago by anton.kratz30
3
gravatar for Vincent J. Carey, Jr.
2.0 years ago by
United States
Vincent J. Carey, Jr.6.2k wrote:

see bioconductor.org/help/docker for

Modifying the images

There are two ways to modify these images:

  1. Making changes in a running container and then committing them using the docker commitcommand.
  2. Using a Dockerfile to declare the changes you want to make.

The second way is the recommended way. Both ways are documented here.

ADD COMMENTlink written 2.0 years ago by Vincent J. Carey, Jr.6.2k

I tried this but I am not quite there yet. First I invoked a container of devel_base:

docker run -ti bioconductor/devel_base R

Now, in the virtual R, I insall DESeq2:

source("https://bioconductor.org/biocLite.R")
biocLite("DESeq2")

I quite the container:

quit()

And now I commit the image:

docker commit -m "Installed DESeq2" -a "Anton Kratz" 5d22a0b73b46 bioconductor/devel_base:v2

This works, I now have an image devel_base:v2 with DESeq2 installed in it, but now how can I invoke a container of devel_base:v2 so that RStudio is running? If I invoke my original command, just changed to use the new image instead:

docker run -v $(pwd):/home/rstudio/$USER -p 8787:8787 bioconductor/devel_base:v2

then in just starts R (command line), immediately exits, and there is no RStudio running at the port I specified (container is still running).

ADD REPLYlink written 2.0 years ago by anton.kratz30
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 153 users visited in the last hour