DockerSpawner persistant volume per user and per image


Is it possible to create multiple persistant volumes per user and per image when using DockerSpawner?

Under section “Volume mapping”, we can see an example where the username of the user can be used in the name of the Docker volume using the {username} tag.

However, when using DockerSpawner, it is possible for a user to run an instance of more than one image at the same time. Thus, needing one persistant volume per user and per image, not only per user.

So, I was wondering if using another tag like {image}, {server} or {environment} is possible or if there is another solution which haven’t crossed my mind.

These are the supported template tags:

but you can extend that by defining your own function to generate the name

I guess that’s what I was looking for.

It’s a shame that JupyterHub’s documentation is in such a mess and lacking contributions.

If you’re interested in improving the DockerSpawner documentation the files are in the docs directory of the GitHub repository: