Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volume is not created when using VOLUME in Dockerfile #2170

Closed
tvass opened this issue Jan 16, 2019 · 11 comments
Closed

Volume is not created when using VOLUME in Dockerfile #2170

tvass opened this issue Jan 16, 2019 · 11 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@tvass
Copy link

tvass commented Jan 16, 2019

/kind bug

Podman does NOT create a volume at run when it is specified in the Dockerfile.

Steps to reproduce the issue:

  1. Create a basic Dockerfile that use VOLUME syntax.
FROM ubuntu
RUN mkdir /myvol
RUN echo "hello world" > /myvol/greeting
VOLUME /myvol
  1. Build
$ buildah bud -t test .
STEP 1: FROM ubuntu
STEP 2: RUN mkdir /myvol
STEP 3: RUN echo "hello world" > /myvol/greeting
STEP 4: VOLUME /myvol
STEP 5: COMMIT containers-storage:[overlay@/home/tvass/.local/share/containers/storage+/run/user/1000:overlay.mount_program=/usr/bin/fuse-overlayfs,overlay.mount_program=/usr/bin/fuse-overlayfs]localhost/test:latest
Getting image source signatures
Skipping fetch of repeat blob sha256:2fb7bfc6145d0ad40334f1802707c2e2390bdcfc16ca636d9ed8a56c1101f5b9
Skipping fetch of repeat blob sha256:c8dbbe73b68c96e3252f8191226b700d4f4b284154624fa40a2e6a0c42712a0d
Skipping fetch of repeat blob sha256:1f6b6c7dc482cab1c16d3af058c5fa1782e231cac9aab4d9e06b3f7d77bb1a58
Skipping fetch of repeat blob sha256:2c77720cf318a4c7eaee757162e6bfc364c3ed83a96a525bc20c548e0f75f1af
Copying blob sha256:c6d18d2f24e2942cdf5fabb4c8cd06202fb3f559fa6e57a8d1996e236299a798
 152 B / 152 B [============================================================] 0s
Copying config sha256:8410741373f6544ba90712f8e3faada622526ae444d870288d50bbb10f4983ef
 2.56 KiB / 2.56 KiB [======================================================] 0s
Writing manifest to image destination
Storing signatures
--> 8410741373f6544ba90712f8e3faada622526ae444d870288d50bbb10f4983ef
  1. Run
podman run --rm -ti test sh
# 

On a separate terminal, check volumes present :
Describe the results you received:

$ podman volume ls
DRIVER   VOLUME NAME
$

Describe the results you expected:
We should have a volume.

$ podman volume ls
DRIVER   VOLUME NAME
local    xxxxxxxxxxxxxxxxxxxxxxxxxx
$

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:

podman version 0.12.1.2

Output of podman info:

podman info
host:
  BuildahVersion: 1.6-dev
  Conmon:
    package: podman-0.12.1.2-1.git9551f6b.fc29.x86_64
    path: /usr/libexec/podman/conmon
    version: 'conmon version 1.12.0-dev, commit: 67ab7549b44484cc3f201d7bb2b58b922f8edc24'
  Distribution:
    distribution: fedora
    version: "29"
  MemFree: 6490259456
  MemTotal: 16450523136
  OCIRuntime:
    package: runc-1.0.0-66.dev.gitbbb17ef.fc29.x86_64
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc6+dev
      commit: ead425507b6ba28278ef71ad06582df97f2d5b5f
      spec: 1.0.1-dev
  SwapFree: 8296329216
  SwapTotal: 8296329216
  arch: amd64
  cpus: 8
  hostname: dhcp-10-17-17-222.yul.redhat.com
  kernel: 4.19.14-300.fc29.x86_64
  os: linux
  rootless: true
  uptime: 4h 54m 21.87s (Approximately 0.17 days)
insecure registries:
  registries: []
registries:
  registries:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  ContainerStore:
    number: 1
  GraphDriverName: overlay
  GraphOptions:
  - overlay.mount_program=/usr/bin/fuse-overlayfs
  - overlay.mount_program=/usr/bin/fuse-overlayfs
  GraphRoot: /home/tvass/.local/share/containers/storage
  GraphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
  ImageStore:
    number: 20
  RunRoot: /run/user/1000

Additional environment details (AWS, VirtualBox, physical, etc.):
Fedora 29

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 16, 2019
@mheon
Copy link
Member

mheon commented Jan 16, 2019

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.

@rhatdan
Copy link
Member

rhatdan commented Jan 16, 2019

We should be creating that.
@umohnani8 PTAL
@tvass could you see if this is fixed in podman 1.0?

@tvass
Copy link
Author

tvass commented Jan 17, 2019

@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
$

@rhatdan
Copy link
Member

rhatdan commented Jan 24, 2019

Is myvolume present within a container you run?

@tvass
Copy link
Author

tvass commented Jan 24, 2019

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

@mheon
Copy link
Member

mheon commented Jan 24, 2019

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.

@rhatdan
Copy link
Member

rhatdan commented Jan 29, 2019

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

@rhatdan
Copy link
Member

rhatdan commented Jan 29, 2019

Ok, I see it now, this volume is not listed under podman volume though.

@umohnani8
Copy link
Collaborator

@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.

@rhatdan
Copy link
Member

rhatdan commented Jan 29, 2019

I found a bunch of bogs on podman volumes and have opened a PR on this.

Lots of fixes in #2229

@umohnani8 umohnani8 assigned rhatdan and unassigned umohnani8 Feb 4, 2019
@rhatdan
Copy link
Member

rhatdan commented Mar 8, 2019

This is fixed in master.

@rhatdan rhatdan closed this as completed Mar 8, 2019
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

5 participants