Docker containers for Bioconductor

Docker allows software to be packaged into containers: self-contained environments that contain everything needed to run the software. Containers can be run anywhere (containers run in modern Linux kernels, but can be run on Windows and Mac as well using a virtual machine called Docker Toolbox. Containers can also be deployed in the cloud using Amazon EC2 Container Service or other cloud providers.

Why use Bioconductor containers

With Bioconductor containers, we hope to enhance

Our aim is to provide up-to-date containers for the current release and devel versions of Bioconductor, and some older versions. Bioconductor’s Docker images are stored in Docker Hub; the source Dockerfiles are in Github.

Our release images are based on rocker/rstudio and built when a Biocondcutor Release occurs. Our devel images are based on rocker/rstudio-daily and built weekly with the latest versions of R and Bioconductor packages.

For each supported version of Bioconductor, we provide several images:

[ Back to top ]

Current Containers

Maintained by the Bioconductor Core Team: bioc-issue-bot@bioconductor.org
Maintained by Steffen Neumann: sneumann@ipb-halle.de

Maintained as part of the “PhenoMeNal, funded by Horizon2020 grant 654241”

Maintained by Laurent Gatto: lg390@cam.ac.uk

Maintained by RGLab: wjiang2@fredhutch.org

[ Back to top ]

Legacy Containers

The following containers are legacy and no longer updated. They have been kept to retain previous versions available via tags:

[ Back to top ]

Using the containers

A well organized guide to popular docker commands can be found here. For convenience, below are some commands to get you started. The following examples use the bioconductor/devel_base2 image.

Note: that you may need to prepend sudo to all docker commands.

Prerequisites: On Linux, you need Docker installed and on Mac or Windows you need Docker Toolbox installed and running.

List which docker machines are available locally
docker images
List running containers
docker ps
List all containers
docker ps -a
Resume a stopped container
docker start <CONTAINER ID>
Shell into a running container
docker exec -it <CONTAINER ID> /bin/bash
Shutdown container
docker stop <CONTAINER ID>
Delete container
docker rm <CONTAINER ID>
Delete image
docker rmi bioconductor/devel_base2

Running the container

The above commands can be helpful but the real basics of running a Bioconductor docker involves pulling the public image and running the container.

Get a copy of public docker image
docker pull bioconductor/devel_base2
To run RStudio Server:
docker run -e PASSWORD=<pickYourPassword> -p 8787:8787 bioconductor/devel_base2

You can then open a web browser pointing to your docker host on port 8787. If you’re on Linux and using default settings, the docker host is 127.0.0.1 (or localhost, so the full URL to RStudio would be http://localhost:8787). If you are on Mac or Windows and running Docker Toolbox, you can determine the docker host with the docker-machine ip default command.

In the above command -e PASSWORD= is setting the rstudio password and is required by the rstudio docker image. It can be whatever you like except it cannot be rstudio. Log in to RStudio with the username rstudio and whatever password was specified.

If you want to run RStudio as a user on your host machine, in order to read/write files in a host directory, please read this.

To run R from the command line:
docker run -ti --user bioc bioconductor/devel_base2 R
To open a Bash shell on the container:
docker run -ti --user bioc bioconductor/devel_base2 bash

Note: The docker run command is very powerful and versatile. For full documentation, type docker run --help or visit the help page.

[ Back to top ]

Mounting Additional Volume

One such option for docker run is -v to mount an additional volume to the docker image. This might be useful for say mounting a local R install directory for use on the docker. The path on the docker image that should be mapped to a local R library directory is /usr/local/lib/R/host-site-library. The follow example would mount my locally installed packages to this docker directory. In turn, that path is automatically loaded in the R .libPaths on the docker image and all of my locally installed package would be available for use.

docker run \
    -v /home/lori/R/x86_64-pc-linux-gnu-library/3.6-BioC-3.9:/usr/local/lib/R/host-site-library \
    -it --user bioc bioconductor/devel_base2 R

[ Back to top ]

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 commit command.
       docker commit <CONTAINER ID> <name for new image> 
    
  2. Using a Dockerfile to declare the changes you want to make.

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

[ Back to top ]

List of packages installed on the core2 container

These packages, plus their dependencies, are installed:

[ Back to top ]

Acknowledgements

Thanks to the rocker project for providing the R/RStudio Server containers upon which ours are based.