Bug 1914096

Summary: Needs improvement: Building, running, and managing containers: 3.4. Sharing files between two containers
Product: Red Hat Enterprise Linux 8 Reporter: Joerg K <joerg.kastning>
Component: DocumentationAssignee: Gabriela Nečasová <gnecasov>
Documentation sub component: default QA Contact:
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: high    
Priority: high CC: joerg.kastning, rhel-docs, tcapek
Version: ---Keywords: Documentation
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-01-25 10:53:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Joerg K 2021-01-08 06:29:18 UTC
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 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:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/building_running_and_managing_containers/index#sharing-files-between-two-containers_building-running-and-managing-containers

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

Regards,
Joerg

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:

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/building_running_and_managing_containers/index#sharing-files-between-two-containers_building-running-and-managing-containers

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.

Regards,  
Joerg

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, 
Gabi