This repo serves as a simple demo for writing a Dockerfile (and building the resulting Docker image) using the containerit R package. You should read more about containerit at the linked package homepage, but very briefly: it uses some neat heuristics and shortcuts to build a Docker image simply based on the contents of your existing directory or repo. Or, more precisely, the R files contained therein.
To run the demo, clone this repo to your local computer and then run the
create-docker.R script (e.g. using RStudio or
$ Rscript create-docker.R).
- Write a Dockerfile to disk (based on the contents of the
R/sub-directory of the repo), and
- Build the corresponding Docker image (creatively titled
containerit-demo) associated with our new Dockerfile
The latter step requires that you actually have Docker installed and running on
your system. (If not, then you can at least still write the Dockerfile for others
to use/build.) Assuming that this is true, you can run the container by calling,
$ docker run --rm -ti containerit-demo.
The Docker image that we're building here isn't terribly exciting or complicated.
It mostly contains some additional spatial libraries (since the
sub-directory requires the sf package) and builds upon the
rocker/rstudio stack. But the point
is that all that work is done for us automatically and with minimal pain.