Docker and CI/CD · Junior · Question 8 of 75
What does WORKDIR /app do?
- ✓Correct answer: Sets the directory for the next instructions and the container
- 2Mounts the host's current folder into
/appwhen the container runs - 3Copies the whole project into
/appbefore the build starts
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.