containr

R-CMD-check DOI

containr helps researchers containerize their R projects. Its core function, generate_dockerfile(), analyzes a project’s environment and dependencies via renv.lock and generates a ready-to-use Dockerfile — so analyses can be reliably shared, archived, and rerun across systems.

Installation

You can install containr from CRAN:

install.packages("containr")

Or install the development version from GitHub:

# install.packages("pak")
pak::pak("erwinlares/containr")

Usage

Below are common ways to use generate_dockerfile():

library(containr)

# Generate a Dockerfile with the latest R version and renv.lock dependencies
generate_dockerfile()

# Specify a particular R version
generate_dockerfile(r_version = "4.3.0")

# Use an RStudio Server image
generate_dockerfile(r_mode = "rstudio")

# Print progress messages during generation
generate_dockerfile(verbose = TRUE)

# Add explanatory comments to the generated Dockerfile
generate_dockerfile(comments = TRUE)

Citation

To cite containr in publications:

citation("containr")

License

Apache License (>= 2) © Erwin Lares