Skip to contents

Removes a line at the specified position from a dockerfile.

Usage

dfm_remove_line(dockerfile, line_num)

Arguments

dockerfile

A dockerfile object

line_num

Line number to remove

Value

An updated dockerfile object with the specified line removed

See also

dfm_add_line() for adding a line & dfm_replace_line() for replacing a line

Other dockerfile modification functions: dfm_add_line(), dfm_group_similar(), dfm_move_line(), dfm_replace_line(), dfm_sort_by_instruction()

Examples

df <- dockerfile() |>
  dfi_from("rocker/r-ver:4.4.0") |>
  dfi_run("apt-get update") |>
  dfi_run("apt-get install -y libcurl4-openssl-dev")
  
# Remove the second RUN instruction (line 3)
df <- dfm_remove_line(df, 3)