Skip to content

dockerfiler

1.0.0Package record

Easy Dockerfile Creation from R

2packages dependsuggested by 1
40.4Kdownloads / year
99.7%test coverage
13/13flavors OK

Overview

About

Build a Dockerfile straight from your R session. 'dockerfiler' allows you to create step by step a Dockerfile, and provide convenient tools to wrap R code inside this Dockerfile.

Changes in 1.0.0

First major release. The version is bumped to 1.0.0 to signal API

maturity after a stabilisation cycle that overhauled the

input-validation surface, hardened the codegen against renv.lock /

DESCRIPTION injection, removed the vendored copy of {renv}, and

flipped the high-level generators' defaults to multi-arch

rocker/r-ver + binary packages from Posit Public Package Manager.

See below.

Breaking changes

  • The vendored copy of {renv} (~30,000 lines under inst/vendor/) is removed. Lockfiles are now parsed with jsonlite::read_json() (already in Imports). The exported dockerfiler::renv symbol is removed: it was a public-API surface only because the vendor pattern required it. The fallback renv_version value, when both the user argument is missing and the lockfile does not pin renv, is now NULL (install the latest renv from the configured repos), aligned with the existing renv_version = NULL behaviour. Closes #94.
Show all changes in 1.0.0Hide the rest of the changes in 1.0.0
  • dock_from_renv() now defaults to running the runtime container as the rstudio user (previously root). The generated Dockerfile gains a defensive RUN id -u rstudio || useradd -m -d /home/rstudio -s /bin/bash rstudio early so the user is created if the FROM image does not already ship one (no-op on rocker/* images, real useradd on r-base, ubuntu:*, debian:*). The renv cache is auto-derived to /home/<user>/.cache/R/renv and chowned to <user> before the USER directive drops privilege; the USER directive itself is emitted right before the renv::restore() cache-mount RUN, so every step that needs root (apt-get, R installs) still runs as root. Pass user = NULL to opt out and keep the previous root behaviour. debian/ubuntu only; for alpine-based images you must pass user = NULL and create the user yourself. Closes #100.
  • dock_from_renv() default FROM flips from "rocker/r-base" (amd64-only) to "rocker/r-ver" (multi-arch: linux/amd64 + linux/arm64), and the R version from the renv.lock file is now appended at codegen time (e.g. rocker/r-ver:4.5.0). Apple Silicon and ARM Linux hosts (Ampere, AWS Graviton) now build natively without Rosetta. Pass the legacy FROM = "rocker/r-base" to opt out. dock_from_desc()'s default FROM was already rocker/r-ver:<R version> and is unchanged. Closes #47.
  • dock_from_renv() and dock_from_desc() default repos flips from "https://cran.rstudio.com/" (source-only CRAN mirror) to "https://p3m.dev/cran/latest" (Posit Public Package Manager), with automatic rewrite to the __linux__/$VERSION_CODENAME/ shape at codegen time so the build pulls pre-compiled Linux binaries instead of compiling from source. Build time on packages with C/C++ deps drops from minutes to seconds. The PPM rewrite logic now matches all three Posit-managed PPM hosts: packagemanager.posit.co, packagemanager.rstudio.com, and p3m.dev. Pass the legacy repos = c(CRAN = "https://cran.rstudio.com/") to opt out. Closes #57.

Security

  • dock_from_desc() and dock_from_renv() now validate every user-supplied parameter that flows into a Dockerfile shell context (FROM, AS, repos values and names, extra_sysreqs, renv_version, renv_paths_cache, lockfile basename, use_pak, strict_install, plus r_version read from the lockfile). Inputs that contain shell metacharacters, newlines, or do not match the documented format raise an explicit error at function entry, rather than silently producing a malformed Dockerfile or one that executes attacker-controlled commands at docker build time. This closes the post-#106 audit follow-up for all five sites surfaced by Copilot review.
  • Fixed a long-standing code-injection path in dock_from_renv(): the renv package version resolved from the lockfile (lock$Packages$renv$Version) was interpolated raw into the generated R -e 'remotes::install_version("renv", version = "<x>")' line without passing through .validate_renv_version(). A crafted renv.lock could break out of the inner R string and execute arbitrary code as root at docker build time. The user-supplied renv_version= argument has been validated since the 1.0.0 shell-context hardening above, but the lockfile-fallback path was missed; the bug itself predates 1.0.0 (it existed while the vendored {renv} parser was in use). The validator is now applied to the resolved value whatever its source. Found by an internal security audit before release.
  • Tightened the .validate_r_version() "X.Y.Z Patched" branch to require a single literal space (it previously used \s, which in R also matches a newline or tab): a lockfile whose R$Version carried an embedded newline would pass validation and then emit a two-line FROM directive. Not exploitable for command injection, but it could silently break docker build.
  • Fixed a long-standing code-injection path in dock_from_desc(): package names read from the DESCRIPTION were interpolated into generated Dockerfile directives without validation. read.dcf() and desc::desc_get_deps() both join DCF continuation lines with \n, so a crafted Package: field, or a crafted Imports: / Depends: / Suggests: / LinkingTo: entry, could carry a continuation line that injects an extra Dockerfile directive (e.g. a RUN) executing as root at docker build time -- the Package: field via the COPY <pkg>_*.tar.gz /app.tar.gz line and the tar.gz-cleanup glob on the build_from_source = FALSE path, and the dependency names via the remotes::install_version("<name>", ...) install RUNs on the default build_from_source = TRUE path. Both the package name and every dependency-field name are now validated against the CRAN package-name grammar at function entry. The bug predates 1.0.0. Found by the same internal security audit as the dock_from_renv() fix above.

New features

  • dock$ARG() and the internal add_arg() helper gain a default parameter to emit ARG <name>=<default> instead of ARG <name>. Closes #8.
  • dock_from_desc() and dock_from_renv() gain a github_pat parameter (default "none") controlling how a GitHub PAT is provided to remotes::install_github() / remotes::install_local() / renv::restore() for private dependency repositories. Set to "build_arg" to emit ARG GITHUB_PAT + ENV propagation (passed via --build-arg GITHUB_PAT=$GITHUB_PAT), or "secret" to use BuildKit secret mounts (the PAT is never persisted in image metadata; recommended for published images). Closes #18.
  • dock_from_renv() gains a renv_paths_cache parameter that controls the RENV_PATHS_CACHE build-arg default, the propagated ENV value, and the cache mount target. When NULL (the default), the path is auto-derived from user: /root/.cache/R/renv for user = NULL, and /home/<user>/.cache/R/renv otherwise. Users can override the renv cache location at image build time with --build-arg RENV_PATHS_CACHE=... without regenerating the Dockerfile.
  • dock_from_desc() gains a strict_install parameter (default TRUE). When TRUE, every install RUN in the generated Dockerfile is prefixed with options(warn = 2); so any R warning during install (missing CRAN package, partial download, archived package, 404 on a remote) becomes a hard error and aborts the docker build. This is a behaviour change for users regenerating their Dockerfile: install RUNs now refuse to silently swallow warnings. Pass strict_install = FALSE if your build environment routinely emits benign warnings (locale defaulting, NTP time-verification, ABI-version notices) that you do not want to fail the build. Closes #9.

Bug fixes

  • r() no longer silently rewrites user code. The previous implementation called gsub(" [2,]", " ", code) (a typo for {2,}) which deleted any digit 2 or comma preceded by a space: r(c(1, 2, 3)) returned R -e 'c(1, , 3)'. The replacement approach (gsub("[ ]{2,}", " ", code)) still collapsed runs of spaces inside string literals (r(cat("a b")) would emit R -e 'cat("a b")'). The fix uses trimws() on each deparse() line then paste(collapse = " "): only the line-wrap indentation added by deparse() is removed, internal whitespace is preserved. Closes #95.
  • r() now wraps the deparsed R expression with shQuote(., type = "sh") instead of inlining it inside a hand-rolled single-quoted shell string. Apostrophes inside string literals no longer break the emitted command: r(message("don't")) used to emit R -e 'message("don't")', which the shell refuses to parse (unterminated quoted string). The new wrapping is shell-safe by construction.
  • dock_from_desc(build_from_source = FALSE) no longer carries a dead-code branch (if (missing(out))) on the locally-assigned result of pkgbuild::build(). missing() only reports unsupplied function arguments, so the branch was unreachable; the success path always ran when build() returned. The branch is removed; failures of pkgbuild::build() propagate normally via stop(). Closes #98.
  • dock_from_desc(): fixed two length(x > 0) typos in the dependency handling (the intent was length(x) > 0); the conditions now behave as documented.
  • The <pkg>_*.tar.gz cleanup glob in dock_from_desc(build_from_source = FALSE) is now built with glob2rx(), so a dot in a package name (e.g. R.utils) is matched literally and a sibling package's tarball is no longer swept up.
  • Internal tidy-ups with no user-visible effect: dropped a duplicate @export in dockerignore.R; the codegen now uses the new dock$ARG(name, default = ...) form instead of inlining the =.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 7.1 min · r-oldrel-windows-x86_64
Status changes
  • OK13 OK2026-08-05
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK13 OK2026-07-05
  • ERROR12 OK, 1 ERROR2026-07-04
  • OK13 OK2026-05-14
Show 2 earlier changesHide 2 earlier changes
  • ERROR11 OK, 1 ERROR2026-04-25
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 1.0.0
README· In the repository, left out of the releaseVignettesYes · 1 · dynamicNEWSYes · 100% structured · mentions 1.0.0Citation fileNoWebsiteYes · pkgdown
Help pages
9 (1 internal)includes a package overview page
Examples that run
50%4 run in a plain check · 4 never run
Exported functions with examples
100%
Documented parameters
96%
Return-value docs
88%
Help pages citing references
0%

Downloads

40.4K
CRAN downloads in the past year
Rank #2,379 · ~111/day · ~3.4K/mo
Daily download trend is not available in this view yet.
2.4K30 days
7K90 days
40.4K1 year
Compare downloads with other packages →
Also on212 r2u1.7K conda_forge

Repository

187Stars
26Forks
1Open issues
1Open PRs
5Releases
128Commits
13Commit identities
hacktoberfesthacktoberfest-acceptedgolemverse
128 commits · Last activity 2026-09-15 · 0% stars, 30d
Responsiveness
How these are sampled
PRs merged (all time)
88%
Median days to close, 50 most recently updated closed issues
418
Median days to close, 50 most recently updated closed PRs
0

Stars over time

2025-08-24 · 1832026-08-12 · 187
PracticesBeta

13 development-tooling and community-health practices detected across 8 families in the upstream repository

Checks run against github.com/thinkr-open/dockerfiler on 2026-10-25.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Governance and community (1)
Code of conduct
Docs source (4)
README.Rmdpkgdown

GitHub Pages site last deployed 2026-09-15 · The repository has a site deploy workflow

Coverage (1)
Coverage reporting (Codecov)
Show all practicesHide 4 practices
Reproducibility and dev environment (1)
data-raw/
CRAN release process (2)
cran-comments.mdCRAN-SUBMISSION
Lint, format, editor (1)
RStudio project
Git structural (1)
.gitattributes
How this is detected·Detection ruleset v4 (2026-10-20)
AI coding toolsBeta

This repository shows signs of AI coding tools.

  • GitHub Copilotfirst seen 2026-09-15
    Pull request: opened by its own account
    Commits: 2 by its own account
Counts are commits, not lines of code. Commits by a tool's accounts count once across all of its accounts. Commits crediting it are the largest count among its credit lines, a minimum.How this is detected·Detection ruleset v4 (updated 2026-09-27)

Dependencies

Declared dependencies
18 external dependencies (excludes base and recommended)

Installing dockerfiler adds 42 packages (21 with compiled code, 14 MB of source tarballs). Heaviest: pak 3.8 MB, fs 1.4 MB, openssl 1.1 MB.

Depends (0)
none
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
2direct
0indirect
Imports 2
Suggested by 1
Depends, Imports or LinkingTo, most downloaded first
Suggests, most downloaded first

People & History

People (4)
Maintainer since 0.1.0 (2018), Author
Author · added in 0.1.4
Author · added in 0.2.0
Author · added in 0.2.0
Releases (11)

Pick two releases to compare their code metrics.

  • 1.0.0Latest
    record
    2026-05-14 · current release · diff ↗ ·
    removed 1 export
    renv
  • R
    R 4.6.0 released · 2026-04-24
  • 0.2.5
    record
    2025-05-07 · diff ↗
  • R
    R 4.5.0 released · 2025-04-11
  • 0.2.4
    record
    2024-08-23 · diff ↗
  • 0.2.3
    record
    2024-07-09 · diff ↗
  • R
    R 4.4.0 released · 2024-04-24
  • 0.2.2
    record
    2023-11-13 · diff ↗ ·
    added 3 exports
    compact_sysreqs, parse_dockerfile, renv
  • R
    R 4.3.0 released · 2023-04-21
  • 0.2.1
    record
    2023-01-18 · diff ↗
  • 0.2.0
    record
    2022-07-06 · diff ↗ ·
    added 1 export
    dock_from_renv
  • R
    R 4.2.0 released · 2022-04-22
  • 0.1.4
    record
    2021-09-03 · diff ↗ ·
    added 2 exports
    docker_ignore_add, get_sysreqs
  • R
    R 4.1.0 released · 2021-05-18
  • R
    R 4.0.0 released · 2020-04-24
  • R
    R 3.6.0 released · 2019-04-26
Show 5 earlier eventsHide 5 earlier events
  • 0.1.3
    record
    2019-03-19 · diff ↗ ·
    added 1 export
    dock_from_desc
  • R
    R 3.5.0 released · 2018-04-23
  • 0.1.1
    record
    2018-04-18 · diff ↗
  • 0.1.0
    record
    2018-03-01
  • R
    R 3.4.0 released · 2017-04-21

Package metadata

First published
2018-03-01
Total releases
11 / 8 yrs
License
MIT + file LICENSE OSI
Download size
66 KB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("dockerfiler")
Fay, C., Guyader, V., Parry, J., & Rochette, S. (2026). dockerfiler: Easy Dockerfile Creation from R (Version 1.0.0) [Computer software]. https://doi.org/10.32614/CRAN.package.dockerfiler

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for dockerfiler version 1.0.0 [Data set]. HJJB, LLC. Data release v2026-10-26. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-26, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy