There are a number of ready built R containers that you can customize for your needs. They come ready built with RStudio.
Docker images built against specific versions are available here - [https://github.com/rocker-org/rocker-versioned2/tree/master/dockerfiles].
You can extend an image using the FROM
Dockerfile declaration.
# Dockerfile
FROM rocker/tidyverse:4.2.2
# Install additional system packages here
RUN sudo apt update && \
apt install -y zlib1g-dev build-essential cmake libglpk-dev libxt-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install additional R Packages here.
RUN Rscript -e "install.packages(c('BiocManager'), repos='https://cran.rstudio.com')"
RUN Rscript -e "BiocManager::install('scran', ask=F)"
Make sure that you are in the directory as your Dockerfile and conda-packages.txt.
# ls -lah
# Dockerfile
docker build -t rocker-r .
You can keep the images locally, or push them to your dockerhub / ecr (gitlab, etc) accounts.
I usually tag with latest and the days date. Cleary, the only sane way to do this is to use the YYYY-MM-DD
format.
export IMAGE="rocker-r"
docker tag ${IMAGE} docker-org/remote-repo:latest
docker tag ${IMAGE} docker-org/remote-repo:DATE ## YYYY.MM.DD
docker push docker-org/remote-repo:latest
docker push docker-org/remote-repo:DATE. ## YYYY.MM.DD
Optionally, you can convert your docker image to a singularity image and store on NFS or S3. This is a more common scenario for HPCs.
This assumes we have a local image named rocker-r
.
export IMAGE="rocker-r"
singularity pull ${IMAGE}.sif docker://${IMAGE}
Images: