Docker
If you want to containerize your R project with Docker there are a few things to keep in mind, as pointed out below. You may also find it helpful to read through this renv documentation.
Installing System Dependencies
Depending on your R environment you will need to install additional system dependencies in your Docker file. This mostly involves some trial and error but boils down to the following steps:
- Checking the output of renv::sysreqs(), e.g. using:r
renv::sysreqs(distro = "ubuntu:24.04", report = TRUE, collapse = TRUE) - Checking the output of
renv::restore()on the first image build. - Debugging the build error messages you get.
Managing Build Context
It's recommended to build the image using a clean repository state, e.g. using:
bash
git clean -f -d -XAlternatively consider using a .dockerignore file.
