Adds an ADD instruction to copy files, directories, or remote files
from source to the container's filesystem at destination.
Details
ADD is similar to COPY, but with additional features:
If
srcis a URL, the file is downloaded from the URLIf
srcis a local tar archive, it will be automatically unpacked
Note that COPY is generally preferred for simple file copying because
it's more explicit and has fewer side effects than ADD.
See also
dfi_copy() for simpler file copying (generally preferred) &
Official Docker ADD documentation
Other dockerfile instruction functions:
dfi_arg(),
dfi_cmd(),
dfi_copy(),
dfi_entrypoint(),
dfi_env(),
dfi_expose(),
dfi_from(),
dfi_healthcheck(),
dfi_label(),
dfi_maintainer(),
dfi_onbuild(),
dfi_run(),
dfi_shell(),
dfi_stopsignal(),
dfi_user(),
dfi_volume(),
dfi_workdir()
Examples
# Add a local file
df <- dockerfile() |>
dfi_from("rocker/r-ver:4.4.0") |>
dfi_add("local.txt", "/app/local.txt")
# Add a file from a URL
df <- dockerfile() |>
dfi_from("rocker/r-ver:4.4.0") |>
dfi_add("https://example.com/file.txt", "/app/file.txt")