Adds a WORKDIR
instruction to set the working directory for any subsequent
RUN
, CMD
, ENTRYPOINT
, COPY
, and ADD
instructions.
Details
The WORKDIR
instruction can be used multiple times in a Dockerfile.
If a relative path is provided, it will be relative to the previous
WORKDIR
instruction. If the directory doesn't exist, it will be created.
See also
dfi_copy()
for copying files into the container,
dfi_run()
for executing commands in the working directory, &
Official Docker WORKDIR
documentation
Other dockerfile instruction functions:
dfi_add()
,
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()
Examples
df <- dockerfile() |>
dfi_from("rocker/r-ver:4.4.0") |>
dfi_workdir("/app") |>
dfi_copy(".", "/app/")