jupyter / tmpnb

Creates temporary Jupyter Notebook servers using Docker containers. [DEPRECATED - See BinderHub project]
https://github.com/jupyterhub/binderhub
BSD 3-Clause "New" or "Revised" License
528 stars 123 forks source link

Question: How to add notebooks when using docker-compose? #264

Open MattKravetz opened 7 years ago

MattKravetz commented 7 years ago

Hi all,

I would like to set up a tmpnb container using docker-compose that will display several pre-built jupyter notebooks to users. This seems like it should be fairly straightforward to do, but I am not seeing this information in the readme or any other issues.

I am using the docker-compose.yml provided in the readme, and have modified it to set the --home_directories flag to the "notebooks" folder on my docker machine that I would like to mount. The notebooks are available in the spawned containers, in the mnt/vol0/ directory, but they are not visible to users in the notebook list. How do I get them in the [user hash]/tree directory?

Thanks!

MattKravetz commented 7 years ago

Hi all,

I got this to work by using a fork of this project, created by apurva3000 (link: https://github.com/apurva3000/tmpnb/tree/user_mount_point). In case anyone else is running into the same issue, the docker-compose.yml file copied below worked for me. /path/on/docker/machine/ in the snippet below should be replaced with whatever folder you want to appear in the notebooks list. I'm sure there has to be a more straightforward way of adding notebooks... but this will get the job done!

httpproxy:
  image: jupyter/configurable-http-proxy
  environment:
    CONFIGPROXY_AUTH_TOKEN: 716238957362948752139417234
  container_name:  tmpnb-proxy
  net: "host"
  command: --default-target http://127.0.0.1:9999
  ports:
    - 8000:8000

tmpnb_orchestrate:
  build: .
  net: "host"
  container_name: tmpnb_orchestrate
  environment:
    CONFIGPROXY_AUTH_TOKEN: 716238957362948752139417234
  volumes:
    - /var/run/docker.sock:/docker.sock
  command: python orchestrate.py --host_directories="/path/on/docker/machine/:/home/jovyan/work/:ro" --command='jupyter notebook --no-browser --port {port} --ip=0.0.0.0 --NotebookApp.base_url={base_path} --NotebookApp.port_retries=0 --NotebookApp.token="" --NotebookApp.disable_check_xsrf=True'