Hub | Status |
---|---|
Docker | |
Singularity |
This script makes it more convenient to run the Bioconductor docker images locally for routine daily usage:
- It creates a host directory
~/dockerhome
where the home directory of the Docker user will be mounted. Files can be shared between the Docker container and host filesystem here. - It results in user-installed packages being added to the host directory
~/.docker-devel-packages
or~/.docker-release-packages
. - It runs the Docker containers waldronlab/bioconductor_devel and waldronlab/bioconductor_release. The script can, however, easily be changed to use any of the official Bioconductor Docker containers.
The waldronlab/bioconductor_devel
and waldronlab/bioconductor_release
images are built on top of the bioconductor/devel_base2
and bioconductor/release_base2
images, respectively. They add many system dependencies so that almost every Bioconductor package can be installed using BiocManager::install()
with no further troubles. As of the last testing, the release image successfully installed all but 10 of over 1,600 packages (testing done with this gist). For almost everyone, this means no more errors when trying to install a package.
To make a generalization, Docker is more supported by commercial Cloud providers, whereas Singularity is (far) more likely to be supported by university high-performance computing facilities.
If you have singularity installed, pull the singularity images as follows:
singularity pull shub://waldronlab/bioconductor_devel
singularity pull shub://waldronlab/bioconductor_release
So far I have only used singularity for bash and R, with aliases like these (assuming you did the above pull commands from your home directory):
alias singulaR="singularity shell $HOME/waldronlab-bioconductor_devel-master-latest.simg R"
alias singularbash="singularity shell $HOME/waldronlab-bioconductor_devel-master-latest.simg bash"
Note that default behavior in singularity is to mount your home (and several other) directories as the home directory within the container, while maintaining your user permissions. This makes all the docker efforts to mount volumes for your container package and home directories unnecessary. I haven't yet tried running rstudio via singularity, but it shouldn't be too hard?
The following aliases may also be useful in your ~/.bash_profile
for command-line R and bash usage with the same containers, package directories, home directory, and rstudio user:
alias releaseshell="docker run -ti -u rstudio -w /home/rstudio -v $HOME/dockerhome:/home/rstudio -v $HOME/.docker-release-packages:/usr/local/lib/R/host-site-library waldronlab/b\
ioconductor_release bash"
alias develshell="docker run -ti -u rstudio -w /home/rstudio -v $HOME/dockerhome:/home/rstudio -v $HOME/.docker-devel-packages:/usr/local/lib/R/host-site-library waldronlab/bioco\
nductor_devel bash"
alias Rrelease="docker run -ti -v $HOME/dockerhome:/home/rstudio -v $HOME/.docker-release-packages:/usr/local/lib/R/host-site-library waldronlab/bioconductor_release R"
alias Rdevel="docker run -ti -v $HOME/dockerhome:/home/rstudio -v $HOME/.docker-devel-packages:/usr/local/lib/R/host-site-library waldronlab/bioconductor_devel R"
#default:
alias R=Rdevel
- Install a docker client for your operating system.
- Make sure home directories are being shared (Whale icon -> Preferences -> File Sharing). Last I checked, this was already the case by default. You can also change the allotted system resources if you want.
- Copy the
bioconductor
script from this repo to somewhere in your $PATH. Modify as you see
fit, e.g. if you want to mount different directories or in a different
place than
~/dockerhome
, or change the rstudio password. Make sure the script is executable (e.g.chmod a+x bioconductor
). - From the command-line, type
bioconductor devel
orbioconductor release
. Later you can use Ctrl-C to stop the container. There are additional usage tips at https://github.com/Bioconductor/bioc_docker, including how to access the image from a command-line. - In a browser, open http://localhost:8787. Login with username is "rstudio" and password "rstudiopassword" unless you change the password in the "bioconductor" script of step 3.
That's it! You can stop the instance you're running and switch to
release or devel (but you can't currently run both at the same
time). There will be separate host package libraries for
user-installed packages (in ~/.docker-devel-packages
and
~/.docker-release-packages
), and a common home directory in
~/dockerhome
. docker pull
is run each time you invoke the
bioconductor
script, so you should automatically get the most
up-to-date Bioconductor release or devel versions, and will only have
to run BiocManager::install()
to update user-installed packages.
The bioconductor
script is rudimentary and should use docopt,
provide start & stop, and have an option for opening a bash shell or R
console. It could also provide arguments for the volume location etc.
It at least does error at the docker pull
stage if you enter
anything other than "release" or "devel" as the argument.