If you're like me, you just blindly check boxes when submitting packages to CRAN. (The 'submit' button should be labeled 'yolo' as far as I'm concerned.) After getting burned yet again for not actually checking my package with the development build of R, I decided to be slightly less stupid in the future. Rather than install R-devel, I made a docker base image for CRAN checking.

As an example, to check my sadists package, I made essentially the following Dockerfile:

# preamble#
FROM shabbychef/crancheck
MAINTAINER Steven E. Pav, shabbychef@gmail.com

# tweak this to force re-install
ENV DOCKER_INSTALL_NONCE 97c22800_9f88_4830_806a_2614e06600f2

# rinstall somethings...
RUN /usr/local/bin/install2.r PDQutils hypergeo orthopolynom shiny testthat ggplot2 xtable knitr

It starts FROM the crancheck image on docker hub. The general recipe would be to install any system packages via apt-get, then any CRAN packages via install2.r, then any github packages via /usr/local/bin/installGithub.r. The base image 'does the right thing' with respect to the entrypoint and you give the package file as the command.

I built it via:

docker build --rm -t shabbychef/sadists-crancheck docker/

Once the image is built, checking a package is as 'simple' as attaching the local directory as /srv in the container via a volume, and giving the name of the package file. (That is, when the command to the container is sadists_0.2.2.5000.tar.gz, it will try to check, as CRAN, the file /srv/sadists_0.2.2.5000.tar.gz. You had better make sure it is available there, so attach this directory here containing the package to /srv in the container.) In summary, run it like this:

docker run -it --rm --volume $(pwd):/srv:ro shabbychef/sadists-crancheck sadists_0.2.2.5000.tar.gz 

You get output as follows:

* using log directory ‘/tmp/sadists.Rcheck’    
* using R version 3.2.3 (2015-12-10)          
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8                
* using option ‘--as-cran’                    
* checking for file ‘sadists/DESCRIPTION’ ... OK 
* this is package ‘sadists’ version ‘’  

I also made an asciinema screencast, if you like watching such things (note it truncates pauses greater than 3 seconds).