Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Offical apps | Community apps | Demo | Docs | Install
  1. Cloudron Forum
  2. JupyterHub
  3. Accessing mounted volumes in jupyter notebooks

Accessing mounted volumes in jupyter notebooks

Scheduled Pinned Locked Moved JupyterHub
14 Posts 6 Posters 7.0k Views 6 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • nigeilN
    nigeilN
    nigeil
    wrote on last edited by
    #1

    I have been attempting to provide access to a cloudron volume to users working with jupyterhub.

    I have been able to mount the volume to the jupyterhub parent container through the cloudron web interface, and can access it from the web debugging terminal under /media/ as expected.

    However, the volume is not accessible in the spawned jupyterlab instances, either under /media/ or /home/jovyan/ (the default home directory in spawned jupyterlab containers).

    Digging through some of the code that is generated at run-time to spawn jupyterlab containers (such as /run/jupyterhub/config), I do not see any mention of mounting the directories under /media/ to the child containers.

    I imagine the parent container (the jupyterhub server that cloudron directly manages) will need to mount the shared volume to the jupyterlab containers it spawns. However I am not sure how to accomplish this.

    I appreciate any thoughts/guidance cloudron users and staff might have - thank you!

    1 Reply Last reply
    1
    • B
      B
      balticpenguin
      wrote on last edited by
      #2

      Is there already a solution here?

      1 Reply Last reply
      0
      • nebulonN
        nebulonN
        nebulon
        Staff
        wrote on last edited by
        #3

        Currently child container will not inherit the app mounts and thus there is no way to have access to the data in those. We have to revisit how we create subcontainers then and change the behavior of the docker addon then https://docs.cloudron.io/packaging/addons/#docker

        robiR 1 Reply Last reply
        0
        • nebulonN nebulon

          Currently child container will not inherit the app mounts and thus there is no way to have access to the data in those. We have to revisit how we create subcontainers then and change the behavior of the docker addon then https://docs.cloudron.io/packaging/addons/#docker

          robiR
          robiR
          robi
          wrote on last edited by robi
          #4

          @nebulon sysbox would help with that.

          Conscious tech

          1 Reply Last reply
          0
          • B
            B
            balticpenguin
            wrote on last edited by
            #5

            In the settings of Jupyterhub there are
            c.DockerSpawner.volumes and
            c.SwarmSpawner.read_only_volumes
            (https://jupyterhub-dockerspawner.readthedocs.io/en/latest/api/index.html)

            Would this perhaps be a possibility? Currently, however, these config settings do not work.

            Since I have day files with data that I need to read and edit. Therefore it is very inconvenient if I would have to upload them manually. Besides, my colleagues also work with the data. So it would be great if there was a directory "shared" which is in the home directory. Great would be a setting in custumconfig.py like
            c.DockerSpawner.volumes = {'/media/shareddata' : '/home/jovyan/shared'}

            see also https://jupyterhub-dockerspawner.readthedocs.io/en/latest/data-persistence.html#volume-mapping

            1 Reply Last reply
            1
            • girishG
              girishG
              girish
              Staff
              wrote on last edited by
              #6

              @balticpenguin @nigeil I implemented (cloudron) volume mounting for child containers now in https://git.cloudron.io/cloudron/box/-/commit/740c0fe318351ee48dcb069f43e939daa34538e1 but actually I don't think you need this at all.

              I think all you need to do is:

              • Create /app/data/shared directory in JupyterHub's file manager.
              • Then, in customconfig.py
               c.DockerSpawner.volumes['/app/data/shared'] = '/shared'
              
              • That should be it

              Can you please try above? You can then open filemanager. It's important to not "assign" to volumes property but to add to the Dict . The home folder /home/joyvan is already mapped by the package's base config.

              1 Reply Last reply
              1
              • B
                B
                balticpenguin
                wrote on last edited by
                #7

                @girish I have tested and it works. I can share data with other users. But it is possible to get access to mounted volume from the user container? The mounted volume is only accessible in the Jupyterhub container, but not in the user container.

                girishG 1 Reply Last reply
                1
                • B balticpenguin

                  @girish I have tested and it works. I can share data with other users. But it is possible to get access to mounted volume from the user container? The mounted volume is only accessible in the Jupyterhub container, but not in the user container.

                  girishG
                  girishG
                  girish
                  Staff
                  wrote on last edited by
                  #8

                  @balticpenguin thanks for testing. I have fixed the volume sharing for user containers with https://git.cloudron.io/cloudron/box/-/commit/740c0fe318351ee48dcb069f43e939daa34538e1 . One thing is when you do volume sharing, the shared volume is not backed up (because Cloudron does not support backing up volumes yet). Is this OK?

                  1 Reply Last reply
                  1
                  • B
                    B
                    balticpenguin
                    wrote on last edited by
                    #9

                    That's okay with me.
                    Unfortunately, I've noticed another problem: I have also included the volume in the Nextcloud app. Files are uploaded here, which I then have to edit in Jupyterhub. But I don't have write permissions for this file. The user of the file is www-data. When I edit or create files in the Juyperhub app, it belongs to the user wcd.

                    Is there a way to fix this problem?

                    1 Reply Last reply
                    0
                    • girishG
                      girishG
                      girish
                      Staff
                      wrote on last edited by
                      #10

                      @balticpenguin try https://docs.cloudron.io/volumes/#sharing . You can use setfacl to automatically have new files owned by media group.

                      1 Reply Last reply
                      0
                      • B
                        B
                        balticpenguin
                        wrote on last edited by
                        #11

                        If you want to share a volume with Jupyterlab, this is unfortunately not enough. Each user gets their own Jupyterlab container from a notebook image. By default, this is jupyter/datascience-notebook. However, no media group is created in this container. There is also no user cloudron.
                        Since I created my own image, I could simply create the group media and add the user Jovyan. Now it works.

                        1 Reply Last reply
                        1
                        • B
                          B
                          balticpenguin
                          wrote last edited by james
                          #12

                          After updating Cloudron from v9.2.0 to v10.0.3, the integration no longer works. The Jupyter server doesn't even start anymore; instead, it displays the error message "500: Internal Server Error
                          Unhandled error starting server".
                          Here is the output from my log file:

                          Sep 01 08:26:54 [E 2026-09-01 06:26:54.598 JupyterHub user:1012](B Unhandled error starting [USER]'s server: 400 Client Error for http://172.18.0.1:3003/v1.55/containers/create?name=[UUID]-[USER]: Bad Request ("Binds must be under /app/data")
                          Sep 01 08:26:54 [E 2026-09-01 06:26:54.687 JupyterHub pages:364](B Error starting server [USER]: 400 Client Error for http://172.18.0.1:3003/v1.55/containers/create?name=[UUID]-[USER]: Bad Request ("Binds must be under /app/data")
                          Sep 01 08:26:54 [E 2026-09-01 06:26:54.690 JupyterHub log:184](B {
                          Sep 01 08:26:54 [E 2026-09-01 06:26:54.690 JupyterHub log:192](B 500 GET /hub/spawn/[USER] ([USER]@[IP-REDACTED]) 307.71ms
                          
                          1 Reply Last reply
                          2
                          • jamesJ
                            jamesJ
                            james
                            Staff
                            wrote last edited by
                            #13

                            Hello @balticpenguin
                            Please check if your volume is still mounted. This could simply be a mount issue trailing into the app.

                            1 Reply Last reply
                            0
                            • girishG
                              girishG
                              girish
                              Staff
                              wrote last edited by girish
                              #14

                              @balticpenguin thanks for reporting, this should be fixed in 10.0.4 . This was a regression in Cloudron 10

                              1 Reply Last reply
                              1

                              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                              With your input, this post could be even better 💗

                              Register Login
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Bookmarks
                              • Search