jupyterhub-deploy-docker icon indicating copy to clipboard operation
jupyterhub-deploy-docker copied to clipboard

Set different partition for volumes

Open dwinkler1 opened this issue 6 years ago • 2 comments

Hi, the main partition on my system is quite small but I do have a separate, larger, partition where I would like to save persistent data. What's the easiest way to set a different partition to save to volume to? thanks!

dwinkler1 avatar Feb 20 '19 09:02 dwinkler1

You might want to refer directly to Docker's documentation on volumes, but in short you'd need to either create the volumes that are appropriate for you or edit the volumes sections in docker-compose.yml. Here is one way you could do that:

diff --git a/docker-compose.yml b/docker-compose.yml
index ffb3069..623823d 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -33,7 +33,7 @@ services:
       # within the container
       - "/var/run/docker.sock:/var/run/docker.sock:rw"
       # Bind Docker volume on host for JupyterHub database and cookie secrets
-      - "data:${DATA_VOLUME_CONTAINER}"
+      - "/path/on/your/partition/you/want/to/save/data:${DATA_VOLUME_CONTAINER}"
     ports:
       - "443:443"
     links:
@@ -57,9 +57,6 @@ services:
       jupyterhub -f /srv/jupyterhub/jupyterhub_config.py

 volumes:
-  data:
-    external:
-      name: ${DATA_VOLUME_HOST}
   db:
     external:
       name: ${DB_VOLUME_HOST}

dalg24 avatar Feb 20 '19 19:02 dalg24

Thanks for your reply! Unfortunatelly this did not work for me. The docker volume gets created even earlier than that as far as I understand. I ended up changing the following

c.DockerSpawner.volumes = { 'jupyterhub-user-{username}': notebook_dir }

in the jupyter_config file to

userfiles = '/mnt/OTHERDRIVE/'
c.DockerSpawner.volumes = { userfile+'{username}': notebook_dir }

and set notebook_dir to home s.t. the home folder is mounted. For R this works great as I can just set the library location to a (hidden) folder in home and install everything there (ie on the large drive). I'm still battling with conda and julia though.

dwinkler1 avatar Feb 22 '19 16:02 dwinkler1