Closed tvass closed 5 years ago
I believe our default driver for image volumes is to create per-container persistent directories, for which this would be the expected behavior. We don't presently support named volumes for image volumes, but I don't believe it would be that hard to implement.
We should check what the default behavior in Docker is and reference that.
We should be creating that. @umohnani8 PTAL @tvass could you see if this is fixed in podman 1.0?
@rhatdan tl;dr Does NOT work with podman 1.0.
Version check:
$ /home/tvass/go/src/github.com/containers/libpod/bin/podman version
Version: 1.0.1-dev
Go Version: go1.11.4
Git Commit: "ab4eea6e9ba7419ee6975afbc1a71ed55984df5a"
Built: Thu Jan 17 09:12:52 2019
OS/Arch: linux/amd64
Check if a volume is present in container spec:
$ /home/tvass/go/src/github.com/containers/libpod/bin/podman inspect test
[...]
"Volumes": {
"/myvol": {}
}
[...]
Run test:
$ /home/tvass/go/src/github.com/containers/libpod/bin/podman run --rm -ti test sh
#
Check if volume is present on a separate terminal:
$ /home/tvass/go/src/github.com/containers/libpod/bin/podman volume ls
$
Is myvolume present within a container you run?
Yes.
root@d3e805e8aea1:/# ls -la /myvol
total 12
drwxrwxrwx. 2 root root 4096 Jan 24 19:05 .
drwxr-xr-x. 22 root root 4096 Jan 24 19:05 ..
-rw-rw-rw-. 1 root root 12 Jan 24 19:04 greeting
This is working as intended given the current image code. We don't yet have support for making volumes for image volumes. Probably would not be difficult if we wanted to add it.
Works fine for Root podman.
# cat /tmp/Dockerfile
FROM ubuntu
RUN mkdir /myvol
RUN echo "hello world" > /myvol/greeting
VOLUME /myvol
# podman build -f /tmp/Dockerfile -t test1 /tmp/
STEP 1: FROM ubuntu
STEP 2: RUN mkdir /myvol
--> Using cache 35ad63b1e0d931ead9ba58f55bd0f3d0b147656aeb9e88c9d3b79740e4ebc61c
STEP 3: FROM 35ad63b1e0d931ead9ba58f55bd0f3d0b147656aeb9e88c9d3b79740e4ebc61c
STEP 4: RUN echo "hello world" > /myvol/greeting
--> Using cache bdc60823df53227d380ac602ee05a1c0273e92039b61c21849fb04c7c9e97249
STEP 5: FROM bdc60823df53227d380ac602ee05a1c0273e92039b61c21849fb04c7c9e97249
STEP 6: VOLUME /myvol
--> Using cache 5b6ce2f0c882d841b9e6bc01179c73aab2b6388d3a78aa68504e1720f73ec712
STEP 7: COMMIT test1
# podman run test1 ls /myvol
greeting
Also works for rootless.
$ podman build -f /tmp/Dockerfile -t test1 /tmp/
STEP 1: FROM ubuntu
Getting image source signatures
Copying blob 38e2e6cd5626: 30.80 MiB / 30.80 MiB [=========================] 55s
Copying blob 705054bc3f5b: 849 B / 849 B [=================================] 55s
Copying blob c7051e069564: 517 B / 517 B [=================================] 55s
Copying blob 7308e914506c: 164 B / 164 B [=================================] 55s
Copying config 20bb25d32758: 3.32 KiB / 3.32 KiB [==========================] 0s
Writing manifest to image destination
Storing signatures
STEP 2: RUN mkdir /myvol
--> 51f0247eed9cfad2c42e19a1933efc35b7ca7c14457550a43e304ca59715d9af
STEP 3: FROM 51f0247eed9cfad2c42e19a1933efc35b7ca7c14457550a43e304ca59715d9af
STEP 4: RUN echo "hello world" > /myvol/greeting
--> 567163a2024f25a247d8fa9ed773e84f2febb6b9708e015845791d8e28991e45
STEP 5: FROM 567163a2024f25a247d8fa9ed773e84f2febb6b9708e015845791d8e28991e45
STEP 6: VOLUME /myvol
--> 1315c2bf9a3d3f76ed4e61237487c84d67cfe413209c25659a93353eda7e6482
STEP 7: COMMIT test1
$ podman run test1 ls /myvol
greeting
podman -v podman version 1.0.0
Ok, I see it now, this volume is not listed under podman volume though.
@rhatdan with podman build, buildah bud is doing all the work and we don't have the volumes support in buildah yet. I think that is why the volume is not being created under the path that podman volume checks for any volumes created. I believe something we have to add.
I found a bunch of bogs on podman volumes and have opened a PR on this.
Lots of fixes in https://github.com/containers/libpod/pull/2229
This is fixed in master.
/kind bug
Podman does NOT create a volume at run when it is specified in the Dockerfile.
Steps to reproduce the issue:
On a separate terminal, check volumes present : Describe the results you received:
Describe the results you expected: We should have a volume.
Additional information you deem important (e.g. issue happens only occasionally): Could you please tell me if this is expected or a bug ? Thanks
Output of
podman version
:Output of
podman info
:Additional environment details (AWS, VirtualBox, physical, etc.): Fedora 29