Docker and CI/CD · Junior · Question 8 of 75

What does WORKDIR /app do?

Explanation

It creates the directory if needed and makes later RUN, COPY and CMD relative to it. It's cleaner than RUN cd /app && ..., which doesn't persist between instructions.

Further reading

Problem with a question

Docker and CI/CD · Junior · question 8

Test yourself

Take the Docker and CI/CD · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz