Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Document URL:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/building_running_and_managing_containers/working-with-containers-and-pods_building-running-and-managing-containers#sharing-files-between-two-containers_building-running-and-managing-containers
Section Number and Name:
3.4. Sharing files between two containers
Describe the issue:
Step 2 shows how to save the mount point path to the variable for easier manipulation: $ mntPoint=$(podman volume inspect hostvolume --format {{.Mountpoint}}). This variable is beeing used in steps 5 and 10 to mount the volume into a container.
Using the volume path instead of the volume name to mount a volume into a container causes data loss when some is running `podman volume prune` to remove unused volumes. Because `podman volume prune` is not able to recognize that the volume is being in use when it was mounted using the path instead of the name.
Suggestions for improvement:
Instead of the variable $mntPoint use the volume name 'hostvolume' from step 1 in the code blocks from step 5 and 10.
Maybe you could insert some kind of information or warning box informing about the possible danger of using the volumes path instead of its name when mounting it into a container.
This would prevent users who follow the procedure to the letter from experiencing data loss when running `podman volume prune` like I did.
Additional information:
See Support Case 02838634 or Github [issue 7862](https://github.com/containers/podman/issues/7862) in case you need further technical detail on this.
Comment 1Gabriela Nečasová
2021-01-20 20:15:39 UTC
Hi Gabriela,
Thanks for reaching out.
I've tested your changes and they resolve the issue.
However, I think I've spotted a typo in step 2:
"Notice that if you run `sudo podman volume create hostvolume`, then the mount point changes to `/var/lib/containers/storage/volumes/hostroot/_data`."
In the mount path you wrote 'hostroot' instead of 'hostvolume'. From my lab I can confirm that the path is '/var/lib/containers/storage/volumes/hostvolume/_data'.
Regards,
Joerg
Comment 3Gabriela Nečasová
2021-01-25 09:32:41 UTC
Hi Gabriela,
Thank you very much for solving this issue. The changes you made look awesome and correct. Please, go ahead and close this issue.
Regards,
Joerg
Comment 5Gabriela Nečasová
2021-01-25 10:53:27 UTC
Dear Joerg,
Thank you very much for your quick response and cooperation.
I am closing this issue.
Kind regards,
Gabi