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

Data not copying to volume upon initialization #3945

Closed
PrymalInstynct opened this issue Sep 5, 2019 · 8 comments · Fixed by #3961
Closed

Data not copying to volume upon initialization #3945

PrymalInstynct opened this issue Sep 5, 2019 · 8 comments · Fixed by #3961
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

@PrymalInstynct
Copy link

/kind Bug

Description

Migrating Container environment from Docker to Podman

Creating Container image with application installed (rpm), this application expects data to be persistent is various directories within its install path. My solution to deal with this is to create a volume and attach that volume to the application root path within the container. In Docker the contents of the containers application directory structure would be copied into the volume when it first startes. This is not happening via podman.

Steps to reproduce the issue:

  1. Using the same container image with both Docker & Podman

  2. podman volume create sc_data

  3. podman run -d -v sc_data:/opt/sc -p 8443:443 sc_image

Describe the results you received:

podman logs <container>
/usr/bin/start-sc.sh: line 11: /opt/sc/support/bin/httpd: No such file or directory
ls -l /var/lib/containers/storage/volumes/sc_data/_data/
total 0

Describe the results you expected:

I would expect that the contents of /opt/sc would be copied to the volume sc_data and the container would start. This happens when running the image with docker.

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

Version:            1.4.4
RemoteAPI Version:  1
Go Version:         go1.10.8
OS/Arch:            linux/amd64

Output of podman info --debug:

debug:
  compiler: gc
  git commit: ""
  go version: go1.10.8
  podman version: 1.4.4
host:
  BuildahVersion: 1.9.0
  Conmon:
    package: podman-1.4.4-3.el7.x86_64
    path: /usr/libexec/podman/conmon
    version: 'conmon version 0.3.0, commit: unknown'
  Distribution:
    distribution: '"rhel"'
    version: "7.7"
  MemFree: 4896395264
  MemTotal: 8369545216
  OCIRuntime:
    package: runc-1.0.0-65.rc8.el7.x86_64
    path: /usr/bin/runc
    version: 'runc version spec: 1.0.1-dev'
  SwapFree: 8342466560
  SwapTotal: 8455712768
  arch: amd64
  cpus: 4
  hostname: podman01
  kernel: 3.10.0-1062.el7.x86_64
  os: linux
  rootless: false
  uptime: 455h 16m 31.45s (Approximately 18.96 days)
registries:
  blocked: null
  insecure: null
  search:
  - registry.access.redhat.com
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.centos.org
store:
  ConfigFile: /etc/containers/storage.conf
  ContainerStore:
    number: 1
  GraphDriverName: overlay
  GraphOptions: null
  GraphRoot: /var/lib/containers/storage
  GraphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  ImageStore:
    number: 3
  RunRoot: /var/run/containers/storage
  VolumePath: /var/lib/containers/storage/volumes

Package info (e.g. output of rpm -q podman or apt list podman):

podman-1.4.4-3.el7.x86_64

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

Host is virtualized with VMWare

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

mheon commented Sep 5, 2019

Hmm. We migrate data into the volume when it's creating with the container (e.g. podman run --volume doesnotexist:/mountpoint ... would copy the contents of /mountpoint into the container into the doesnotexist volume as part of creating it). Let me double-check that Docker also copies for first instance of mounting after create, as well

@mheon
Copy link
Member

mheon commented Sep 5, 2019

Hm. It looks like Docker does copy contents to the volume on first mount. I'll look into adding this.

@mheon mheon self-assigned this Sep 5, 2019
@PrymalInstynct
Copy link
Author

Thanks for investigating, this function is critical to what I am trying to accomplish.

@rhatdan
Copy link
Member

rhatdan commented Sep 6, 2019

@mheon Should we assign this to @QiWang19?

@mheon
Copy link
Member

mheon commented Sep 6, 2019

Eh, I'm in there already for adding volume driver support, and this one shouldn't be more than a half hour of work now that I am.

@rhatdan
Copy link
Member

rhatdan commented Sep 6, 2019

Ok.

mheon added a commit to mheon/libpod that referenced this issue Sep 6, 2019
Previously, we only did this for volumes created at the same time
as the container. However, this is not correct behavior - Docker
does so for all named volumes, even those made with
'podman volume create' and mounted into a container later.

Fixes containers#3945

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
mheon added a commit to mheon/libpod that referenced this issue Sep 6, 2019
Previously, we only did this for volumes created at the same time
as the container. However, this is not correct behavior - Docker
does so for all named volumes, even those made with
'podman volume create' and mounted into a container later.

Fixes containers#3945

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
mheon added a commit to mheon/libpod that referenced this issue Sep 6, 2019
Previously, we only did this for volumes created at the same time
as the container. However, this is not correct behavior - Docker
does so for all named volumes, even those made with
'podman volume create' and mounted into a container later.

Fixes containers#3945

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
mheon added a commit to mheon/libpod that referenced this issue Sep 6, 2019
Previously, we only did this for volumes created at the same time
as the container. However, this is not correct behavior - Docker
does so for all named volumes, even those made with
'podman volume create' and mounted into a container later.

Fixes containers#3945

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
mheon added a commit to mheon/libpod that referenced this issue Sep 9, 2019
Previously, we only did this for volumes created at the same time
as the container. However, this is not correct behavior - Docker
does so for all named volumes, even those made with
'podman volume create' and mounted into a container later.

Fixes containers#3945

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
mheon added a commit to mheon/libpod that referenced this issue Sep 9, 2019
Previously, we only did this for volumes created at the same time
as the container. However, this is not correct behavior - Docker
does so for all named volumes, even those made with
'podman volume create' and mounted into a container later.

Fixes containers#3945

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
mheon added a commit to mheon/libpod that referenced this issue Sep 9, 2019
Previously, we only did this for volumes created at the same time
as the container. However, this is not correct behavior - Docker
does so for all named volumes, even those made with
'podman volume create' and mounted into a container later.

Fixes containers#3945

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
mheon added a commit to mheon/libpod that referenced this issue Sep 9, 2019
Previously, we only did this for volumes created at the same time
as the container. However, this is not correct behavior - Docker
does so for all named volumes, even those made with
'podman volume create' and mounted into a container later.

Fixes containers#3945

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
@pycloux
Copy link

pycloux commented Dec 29, 2021

Don't know if this is "on purpose" but the behavior is still different from Docker default one.
If you mount an "empty" volume into a docker container to a new path (say "/opt/test") and then mount the same volume to another container to a "non-empty" path, then the content of the "non-empty" path will be copied on to the volume.
With Podman (I just tested it with the version 3.3.1), the volume will remain "empty" as soon as it was mounted to one container. Docker is more permissive and will allow the data to be copied if the volume is empty.

@rhatdan
Copy link
Member

rhatdan commented Dec 29, 2021

Please open a new issue.

@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 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 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

Successfully merging a pull request may close this issue.

5 participants