aboutsummaryrefslogtreecommitdiff
path: root/test/build/preserve-volumes/Dockerfile
blob: 922f565d7d1def07d4822023780923d5366e12c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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