-
Story
-
Resolution: Unresolved
-
Minor
-
None
-
DO188 - RHOCP4.18-en-3-20250829
-
False
-
-
False
-
4
-
-
-
en-US (English)
Please fill in the following information:
URL: | https://role.rhu.redhat.com/rol-rhu/app/courses/do188-4.18/pages/ch04s04 |
Reporter RHNID: | acancell@redhat.com |
Section Title: | Guided Exercise: Build Images with Advanced Containerfile Instructions |
Issue description:
Clarify that WORKDIR is NOT preserved between multistages
Example:
~~~
FROM registry.access.redhat.com/ubi9/ubi:9.5 AS first
WORKDIR /opt
RUN pwd # == /opt
RUN echo test > test.txt # is saved on /opt/test.txt
FROM registry.access.redhat.com/ubi9/ubi:9.5
RUN pwd # == “/” That is, WORKDIR is NOT preserved between multistages, but “starts” again form default “/”
- COPY --from=first test.txt /opt/test.txt # WRONG The file on the left would be searched from the “new” WORKDIR, that is in /test.txt
COPY --from=first /opt/test.txt /opt/test.txt # CORRECT
ENTRYPOINT ["sleep"]
CMD ["infinity"]
Steps to reproduce:
Workaround:
Expected result: