-
Notifications
You must be signed in to change notification settings - Fork 217
Description
It would be nice to support sharing in single files instead of being bound by it being a directory.
Virtiofs doesn't support sharing in single files, so we'd need to get a bit smart. One option is to share in the parent directory of the file, and then bind mount the single file into the containers mount ns. The mount setup code would need to start doing a stat on every mount to ensure it's a file and not a directory and take appropriate action, but that's not too worrying. This approach is concerning as the container may have access (via the parent dir) to a LOT more files than the user actually asked for. It's trivial to call mount(2) in our containers as we don't do any sort of syscall filtering or otherwise, so the container could mount the parent virtiofs dir directly into their container.
A second approach would be to make a tempdir somewhere and hardlink in the single file into this and share that in. This has the downside that it would only work on the same volume however.
Ideally this supports ro and rw. A common case would be to inject host ~/.gradle/init.gradle and ~/.gradle/gradle.properties into a Java build container without mounting the host Gradle cache.