I am using the SystemUserSpawner to spawn docker containers which persist storage to the user’s home directory on disk. I want to mount some other directories to the container and persist them to the home directory as well.
I tried this first:
c.DockerSpawner.volumes = { '/home/{username}/example': '/etc/example' }
JupyterHub starts the container without complaining, but a docker inspect
shows that no such volume mount has been created.
I tried subclassing the spawner in the config as well, which similarly does nothing:
from dockerspawner import SystemUserSpawner
class MyDockerSpawner(SystemUserSpawner):
def start(self):
self.volumes['/home/{username}/example'] = {
'bind': '/etc/example',
'mode': 'rw'
}
return super().start()
c.JupyterHub.spawner_class = MyDockerSpawner
What am I missing here? How do I add mount points to the containers that get spawned?