Dockerfile unexpected behaviour between RUN commands
I have a weird issue trying to execute several RUN commands sequentially.
The goal is to copy a folder.
If I list the files in target folder:
- it works in the same RUN with && ls
- it does not work in another RUN
Here is the trace:
Step 6 : RUN cp -rf /app/httpd/htdocs/* /opt/rh/httpd24/root/var/www/html/ && ls /opt/rh/httpd24/root/var/www/html/ ---> Running in 05842445d075 modules tests ---> 05c51d512f60 Removing intermediate container 05842445d075 Step 7 : RUN ls /opt/rh/httpd24/root/var/www/html/ ---> Running in aa217a8edc37 ---> 095c9f8ac8e7
Do you have any idea what is going wrong?
One Solution collect form web for “Dockerfile unexpected behaviour between RUN commands”
As seen here, that could happen if the Dockerfile declared first a
Any file copied into a
VOLUME would be discarded, as each build-step creates a new volume based on the image’s content, discarding the volume that was used in the previous build step.