Bug 1914096 - Needs improvement: Building, running, and managing containers: 3.4. Sharing files between two containers
Summary: Needs improvement: Building, running, and managing containers: 3.4. Sharing f...
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: Documentation
Version: ---
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: 8.4
Assignee: Gabriela Nečasová
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2021-01-08 06:29 UTC by Joerg K
Modified: 2021-01-25 10:53 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2021-01-25 10:53:27 UTC
Type: Bug
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Github containers podman issues 7862 0 None closed Volume prune command removes used volume 2021-02-15 19:49:56 UTC

Description Joerg K 2021-01-08 06:29:18 UTC
Document URL: 

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 1 Gabriela Nečasová 2021-01-20 20:15:39 UTC
Dear Joerg, 

thank you for your feedback. We fixed it according to your suggestions:

Does it resolve the issue?

Comment 2 Joerg K 2021-01-23 20:04:56 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'.


Comment 3 Gabriela Nečasová 2021-01-25 09:32:41 UTC
Dear Joerg,

Thank you very much for your message. 
I checked it again and yes, you are right. 

It is fixed now:


Can we close this issue now? 

Thank you for the cooperation. 
Kind regards

Comment 4 Joerg K 2021-01-25 10:50:01 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.


Comment 5 Gabriela 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, 

Note You need to log in before you can comment on or make changes to this bug.