Skip to contents

Creates an empty dockerfile object that can be populated with Docker instructions.

Usage

dockerfile()

Value

A dockerfile object with the following structure:

  • lines: Character vector containing Dockerfile instructions

  • metadata: List containing metadata about the Dockerfile:

    • base_image: Base image name

    • package_manager: Package manager type (e.g., "apt", "yum")

    • r_version: R version (if using a rocker image)

    • os: Operating system type

See also

is_dockerfile() for checking if an object is a dockerfile, dfi_from() for adding a base image, & write_dockerfile() for writing a dockerfile to disk

Other dockerfile core functions: add_dockerfile_line(), check_dockerfile(), is_dockerfile(), print.dockerfile()

Examples

# Create a new dockerfile
df <- dockerfile()

# Add instruction for a base image
df <- dfi_from(df, "rocker/r-ver:4.4.0")
df
#> FROM rocker/r-ver:4.4.0 

# Add an instruction to run a command to update system packages
df <- dfi_run(df, "apt update")
df
#> FROM rocker/r-ver:4.4.0
#> RUN apt update