Posts

Showing posts with the label Dockerfile

Building Dockerfile Fails When Touching A File After A Mkdir

Image
Answer : Looking at https://registry.hub.docker.com/u/library/jenkins/, it seems that /var/jenkins_home is a volume. You can only create files there while the container is running, presumably with a volume mapping like docker run ... -v /your/jenkins/home:/var/jenkins_home ... The docker build process knows nothing about shared volumes. This is currently investigated in docker/docker/issues/3639, and summarized in this comment: Okay, I did little research and it seems that volume is non-mutable between Dockerfile instruction . Here even smaller Dockerfile for testing: FROM busybox RUN mkdir /tmp/volume RUN echo "hello" > /tmp/volume/hello VOLUME ["/tmp/volume/"] RUN [[ -f /tmp/volume/hello ]] RUN rm /tmp/volume/hello RUN [[ ! -e /tmp/volume/hello ]] On each instruction we create new volume and copy content from original volume . Update April 2019: Use DOCKER_BUILDKIT=1 The new builder does not exhibit this behavior. Example...