github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/test/build/preserve-volumes/Dockerfile (about) 1 FROM alpine 2 RUN mkdir -p /vol/subvol/subsubvol 3 RUN dd if=/dev/zero bs=512 count=1 of=/vol/subvol/subsubvol/subsubvolfile 4 VOLUME /vol/subvol 5 # At this point, the contents below /vol/subvol should be frozen. 6 RUN dd if=/dev/zero bs=512 count=1 of=/vol/subvol/subvolfile 7 # In particular, /vol/subvol/subvolfile should be wiped out. 8 RUN dd if=/dev/zero bs=512 count=1 of=/vol/volfile 9 # However, /vol/volfile should exist. 10 VOLUME /vol 11 # And this should be redundant. 12 VOLUME /vol/subvol 13 # And now we've frozen /vol. 14 RUN dd if=/dev/zero bs=512 count=1 of=/vol/anothervolfile 15 # Which means that in the image we're about to commit, /vol/anothervolfile 16 # shouldn't exist, either. 17 18 # ADD files which should persist. 19 ADD Dockerfile /vol/Dockerfile 20 RUN stat /vol/Dockerfile 21 ADD Dockerfile /vol/Dockerfile2 22 RUN stat /vol/Dockerfile2