Render dockerized R Markdown documents using Docker containers.

drender(input = NULL, tag = NULL, build_args = NULL,
  container_name = NULL, no_cache = TRUE, output_yaml = TRUE, ...)

Arguments

input

Input file to render in Docker container.

tag

Docker image name to build, sent as docker argument -t. If not specified, it will use the same name as the input file.

build_args

A character string specifying additional docker build arguments. For example, --pull=true -m="1024m" --memory-swap="-1".

container_name

Docker container name to run. If not specified, will use a randomly generated name.

no_cache

Logical. Controls the --no-cache argument in docker run. Setting this to be TRUE can accelerate the rendering speed substantially for repeated compilation since most of the Docker image layers will be cached, with only the changed (knitr related) image layer being updated. Default is TRUE.

...

Additional arguments passed to render.

purge_info

Logical. Should we write the Docker container and image information to a YAML file for purging later? Default is TRUE.

Value

Rendered file is written to the same directory of the input file. A character vector with the image name and container name will be returned. You will be able to manage them with docker commands later or with the cleanup functions.

Details

Before using drender(), run lift on the RMD document first to generate the Dockerfile.

See vignette('liftr-intro') for details about the extended YAML front-matter metadata format and system requirements for rendering dockerized R Markdown documents.

Examples

# copy example file dir_example = paste0(tempdir(), '/liftr-minimal/') dir.create(dir_example) file.copy(system.file("examples/liftr-minimal.Rmd", package = "liftr"), dir_example)
#> [1] TRUE
# containerization input = paste0(dir_example, "liftr-minimal.Rmd") lift(input) ## Not run: ------------------------------------ # # render the document with Docker # drender(input) # # # view rendered document # browseURL(paste0(dir_example, "liftr-minimal.html")) # # # purge the generated Docker image # purge_image(paste0(dir_example, "liftr-minimal.docker.yml")) ## ---------------------------------------------