
c.fault_url = '/lab': Uses Jupyterlab instead of Jupyter Notebook. 'command': : Timeout is the number of seconds until an idle Jupyter instance is shut down. Take note of the following configuration options: ]c.fault_url = '/lab'notebook_dir = os.environ.get('DOCKER_NOTEBOOK_DIR') or '/home/jovyan/work'Ĭ.DockerSpawner.notebook_dir = notebook_dir Import _class = 'dockerspawner.DockerSpawner'Ĭ.DockerSpawner.image = os.environĬ.work_name = os.environĬ.JupyterHub.hub_connect_ip = os.environĬ.JupyterHub.hub_ip = "0.0.0.0" # Makes it accessible from anywhere on your _access = [ env in the same directory as the docker-compose.yml file and add the following contents: To control the network name we use a little hack: we pass an environment variable COMPOSE_PROJECT_NAME to Docker Compose, and the network name is obtained by appending _default to it.Ĭreate a file called. This network gets an automatic name from Docker Compose, but the Hub needs to know this name to connect the Jupyter Notebook servers to it. JupyterHub will create Jupyter Notebooks with the images defined in the environment variable.For more information on selecting Jupyter images you can visit the following Jupyter documentation.ĭOCKER_NETWORK_NAME is the name of the Docker network used by the services. The key environment variables to note are DOCKER_JUPYTER_IMAGE and DOCKER_NETWORK_NAME. Restart: unless-stopped # Configuration for the single-user servers var/run/docker.sock:/var/run/docker.sockĮnvironment: # Env variables passed to the Hub process.ĭOCKER_JUPYTER_IMAGE: jupyter/tensorflow-notebookĭOCKER_NETWORK_NAME: $_default # Build the container from this folder.Ĭontainer_name: jupyterhub_hub # The service will use this container name. Each of these services will exist as a Docker container on the host.īuild. JupyterHub will be the entry point and will spawn JupyterLab instances for any user. The architecture of our JupyterHub server will consist of 2 services: JupyterHub and JupyterLab. We are going to use the combination of Docker and JupyterHub to access Jupyter Notebooks from anytime, anywhere, at the same URL. JupyterHub has pre-built Docker images that we can utilize to spawn a single notebook on a whim, with little to no overhead in technical complexity. Unfortunately, there was no middle ground to have the usability and scalability of JupyterHub and the simplicity of running a local Jupyter Notebook. Jupyter Notebook, however, is supposed to run as a local instance, on a single node, by a single developer. The idea behind JupyterHub was to scale out the use of Jupyter Notebooks to enterprises, classrooms, and large groups of users. JupyterHub brings the power of notebooks to groups of users. One of the benefits of this setup is that you will be able to use Jupyter Notebook from any device on your network, but have all the computation happen on the device we configure. I recommend doing this on the most powerful device you have and one that is turned on for most of the day, preferably all day. To add a cherry on top, it can be managed and sustained through Docker allowing for isolated development environments.īy the end of this post we will leverage the power of JupyterHub to access a Jupyter Notebook instance which can be accessed without a terminal, from multiple devices within your network, and a more user friendly authentication method.Ī basic knowledge of Docker and the command line would be beneficial in setting this up. Lucky for us, Jupyter has already come up with a solution to this problem by coming out with an extension of Jupyter Notebooks that runs as a sustainable web application and has built-in user authentication. Some might “daemonize” the process and then use nohup to detach it from their terminal, but that’s not the most elegant and maintainable solution.
The entire web application relies on that terminal window being open. Each use requires starting the Jupyter web application from the command line and entering your token or password. For such an integral tool, the out of the box start up is not the best. Some even consider it a powerful development when combining it with NBDev. Jupyter Notebook provides a great platform to produce human-readable documents containing code, equations, analysis, and their descriptions.
Photo taken by Justin Jairam from permission)