I’m using Jupyterhub with dockerspawner, and am able to mount specific host folders (read only) based on information about the user that we pass in with the create server API call. We set up the mount in an overwritten start, similar to what was proposed here: Mount different volumes based on userlist/group · Issue #239 · jupyterhub/dockerspawner · GitHub
class MyDockerSpawner(DockerSpawner):
def start(self, image=None, extra_create_kwargs=None, extra_host_config=None):
# We define the data_dir then:
self.volumes[data_dir] = {
"bind": "/home/jovyan/work/shared_data",
"mode": "ro",
}
return super().start(
image=image,
extra_create_kwargs=extra_create_kwargs,
extra_host_config=extra_host_config,
)
The problem is that we regularly update the contents of the mounted folders in a separate process. So when the notebook server first starts it can access all of the files in the mounted directories, but once they’ve been updated - those folders seems to disappear.
After folders have been deleted and recreated (there should be two sub directories shown):
The newly recreated directories look to have all the same permissions as the previous ones (indeed they are all created by the same process). Some help would be much appreciated, as I just can’t understand why mounting a shared directory doesn’t seem to be truly shared.