summaryrefslogtreecommitdiff
path: root/test/build/preserve-volumes/Dockerfile
diff options
context:
space:
mode:
Diffstat (limited to 'test/build/preserve-volumes/Dockerfile')
-rw-r--r--test/build/preserve-volumes/Dockerfile22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/build/preserve-volumes/Dockerfile b/test/build/preserve-volumes/Dockerfile
new file mode 100644
index 000000000..922f565d7
--- /dev/null
+++ b/test/build/preserve-volumes/Dockerfile
@@ -0,0 +1,22 @@
+FROM alpine
+RUN mkdir -p /vol/subvol/subsubvol
+RUN dd if=/dev/zero bs=512 count=1 of=/vol/subvol/subsubvol/subsubvolfile
+VOLUME /vol/subvol
+# At this point, the contents below /vol/subvol should be frozen.
+RUN dd if=/dev/zero bs=512 count=1 of=/vol/subvol/subvolfile
+# In particular, /vol/subvol/subvolfile should be wiped out.
+RUN dd if=/dev/zero bs=512 count=1 of=/vol/volfile
+# However, /vol/volfile should exist.
+VOLUME /vol
+# And this should be redundant.
+VOLUME /vol/subvol
+# And now we've frozen /vol.
+RUN dd if=/dev/zero bs=512 count=1 of=/vol/anothervolfile
+# Which means that in the image we're about to commit, /vol/anothervolfile
+# shouldn't exist, either.
+
+# ADD files which should persist.
+ADD Dockerfile /vol/Dockerfile
+RUN stat /vol/Dockerfile
+ADD Dockerfile /vol/Dockerfile2
+RUN stat /vol/Dockerfile2