Question : Is there any way I could move/copy mount from one namespace to another?
Explanation: I would like to mount directory which didn't exist when container was created.
- I am creating container. It gets it own copy of host mount namespace
- Host creates some
SourceDirectory - Inside host I am bind mounting (with shared option enabled)
SourceDirectoryinto/container_rootfs/tempDirectory - Inside container I would like to read/write file to
/tempDirectoryso it gets toSourceDirectory
Step 4. is not working because on step 3 shared bind mount is only shared for the current host mount namespace, and container namespace was already "split" before. I get /tempDirectory like I wouldn't done step 3 at all.
If directory existed and the mount was made before creating container (so operation order from numbered list above 2 > 3 > 1 > 4) then everything works just fine as now container has mount namespace copied after my additional bind mount was created. And saving to /tempDirectory gets transferred to SourceDirectory.
So my question is - If there is any way that I could move/copy mount from one namespace (mine host mount namespace) to another (container mount namespace)?
If that is relevant (which I don't think so) I am using crun for containers.