WORKDIR sets the working directory for any subsequent RUN, CMD, ENTRYPOINT, COPY, and ADD instructions. It can be used multiple times; relative paths are resolved against the previous WORKDIR.
If the directory does not exist, Docker creates it even if no later instruction uses it.
Example:
WORKDIR /var/node
RUN npm install
Andrew Dorokhov