QuestionQ28

VerifiedContainer Virtualization

If a Dockerfile includes these lines:

WORKDIR /  
  
RUN cd /tmp -  
  
RUN echo test > test -  

Where is the test file located?

Explanation

WORKDIR / establishes / as the working directory for subsequent instructions. Each shell-form RUN executes independently, so a cd /tmp in one RUN instruction does not carry over to the next one. The later relative output path test is therefore created as /test in the container image.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!