R programming software environment Docker image deployment and usage


The automated build Docker image of The R Project for Statistical Computing “linuxconfig/cran-r” can be used to instantly deploy R programming software environment on any hosts given that you have docker already installed on your system.


The docker image with the R Project is compiled and runs on Debian GNU/Linux system.


Here we assume that docker is already installed on your system.First pull docker image:

# docker pull linuxconfig/cran-r

By using docker’s -v option we can now mount and thus make accessible our R working directory within a Docker’s containcer. For an example our r-files directory contains a single R script hello.R:

# cat r-files/hello.R
cat ('Hello world!')

Now, we deploy r-cran docker image and make our local r-files directory available within our new docker container directory/root/. Feel free to change your target directory to fit your needs:

# docker run -it -name cran-r -h cran-r -v $PWD/r-files:/root/ linuxconfig/cran-r /bin/bash

Navigate to your /root/ directory to access your R working files:

# cd
root@cran-r:~# ls
# R CMD BATCH hello.R
root@cran-r:~# cat hello.Rout 

R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> cat ('Hello world!')
Hello world!> 
> proc.time()
   user  system elapsed 
  0.129   0.033   0.245