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:

  • adding R package for installation from Github in Dockerfile
  • Docker complains about invalid certificate after update to v1.7.0
  • How to pull from private docker repository on docker hub?
  • Connecting to Postgresql in a docker container from outside
  • How is “lxd” different from lxc/docker?
  • What does these settings do to make Elasticsearch to run on development mode?
    • 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?

  • docker: Error response from daemon: client is newer than server
  • Install docker 1.11 on Fedora 21
  • How to setup learning environment for Udacity Deep Learning class with TensorFlow (Windows)
  • Jenkins Docker throwing exception and starting offline
  • connection reset by peer when querying dockerized gunicorn
  • How to share a host directory between multiple docker container?
  • One Solution collect form web for “Dockerfile unexpected behaviour between RUN commands”

    As seen here, that could happen if the Dockerfile declared first a VOLUME.

    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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.