WORKDIR

The Dockerfile instruction that sets the folder later instructions and the container start in.

In more detail

WORKDIR /app creates the folder if needed and makes relative paths in COPY, RUN, CMD and ENTRYPOINT resolve from there. Prefer it over RUN cd /app, which only lasts for that one RUN.

Examples

WORKDIR /app
WORKDIR /src
WORKDIR /workspace

Related terms

Taught in

References

Certification courses