Warwick R User Group
James Tripp
Senior Research Software Engineer, IT Services (University of Warwick)
How does this help research?
- rocker/r-ver - alternative to r-base
- rocker/rstudio - R and RStudio
- rocker/tidyverse- R and tidyverse packages
- rocker/shiny - Shiny server built in
- many others
To use the official image
The r-base image downloaded
Container created from image
Terminal enters container
The command line options are to remove the container on exit (-rm) and to create a command line interface with interactivity (-ti)
Downloads image, creates and terminal enters container
The container provides access to RStudio via localhost:8787
You now have an isolated RStudio container running
Command line options are remove the container on exit (-rm), create a command line interface (-ti), set environment variables (-e) and set the port (-p) so that connecting via port 8787 will connect to port 8787 in the container.
FROM r-base
COPY . /usr/local/src/myscripts
WORKDIR /usr/local/src/myscripts
CMD ["Rscript", "myscript.R"]
# MacOS and Linux
docker run --rm -ti -e DISABLE_AUTH="true" -p 8787:8787 -v $(pwd):/home/rstudio/data rocker/rstudio
# Windows
docker run --rm -ti -e DISABLE_AUTH="true" -p 8787:8787 -v absolute_path:/home/rstudio/data rocker/rstudio
#May work on Windows
docker run --rm -ti -e DISABLE_AUTH="true" -p 8787:8787 -v %cd%:/home/rstudio/data rocker/rstudio
Where absolute_path is the full Windows path
myscript.R
dockerfile
FROM r-base
COPY . /usr/local/src/myscripts
WORKDIR /usr/local/src/myscripts
RUN ["install2.r", "fortune"]
CMD ["Rscript", "myscript.R"]
Build and run it
Stevedore - Sends commands to Docker. Required reticulate and the Python docker module. Recieved the error ‘Did not find required python module ’docker’’. Issue reported and not addressed in the past year…
Dockyard - Aims to help you create and run a container. Last commit was 3 years ago and the example code on the github page does not work…
Dockermachine - Last updated 5 years ago.
Peikert and Brandmaier (2021) offer a workflow for rendering markdown documents which includes a make file for dependencies
Not an exhaustive list
Run a docker container on a remote server. Place a button on your public github repo README.md.
Spins up shiny containers with one container per user (see the R Bloggers post)
https://jamestripp.github.io/RandDocker/