JupyterHub: How to persist user data when using GitHub Oauth + DockerContainer?

70 views
Skip to first unread message

Kenneth Tran

unread,
Sep 14, 2016, 10:24:15 AM9/14/16
to jup...@googlegroups.com
  1. How can I map `/home/user` in the container to `some_directory/user` in the host server?
  2. How to automatically create `some_directory/user` and run some init script when a user first signs in?

Thanks

MinRK

unread,
Sep 15, 2016, 4:36:55 AM9/15/16
to Project Jupyter

On Wed, Sep 14, 2016 at 4:23 PM, Kenneth Tran <o...@kentran.net> wrote:

  1. How can I map `/home/user` in the container to `some_directory/user` in the host server?

Assuming you are using DockerSpawner, you would use:

c.DockerSpawner.volumes = {
    '/some_directory/{username}': 'in_container/mountpoint'
}

{username} will be replaced with the user’s name.

  1. How to automatically create `some_directory/user` and run some init script when a user first signs in?

If you subclass Authenticator, the .add_user method is called when new users are added. You can ensure the directory is created at this point. Alternately, you can do this in your Spawner in start by ensuring the directory exists and has the right ownership prior to launching the container.

-Min


Thanks

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CAHmx4LDFyBChuP0jppphcARa5vk2sy8XzEK%2Be4JXRDydOwMf4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages