This repository based on this JupyterHub implementation
This repository offers a simple and convenient way to access Nvidia GPUs using the nvidia-docker-2 container runtime, with added features like code-server and X-server support.
- Fix permission to access the user folder
- Enable the use of Docker Swarm mode
- Support to deploy with k8s
To use this implementation, you must have the following installed on your system:
- A CUDA driver
- Docker 19.03 or higher
- Docker Compose 1.25.5 or higher
You can check if a CUDA driver is installed on your system by running nvidia-smi in the terminal. I recommend following the DigitalOcean tutorial to install Docker Compose, and make sure to change the version number to 1.25.5. Additionally, the nvidia-container-runtime needs to be installed:
sudo apt-get install nvidia-container-runtimeNvidia-docker2 also needs to be installed; refer to their Github repository for instructions.
To enable runtime: nvidia, we need to modify the /etc/docker/daemon.json file as follows:
{
"runtimes": {
"nvidia": {
"path": "/usr/bin/nvidia-container-runtime",
"runtimeArgs": []
}
}
}
We can now build our notebook containers with:
docker build -t "vscode-notebook:lastest" -f ./dockerfile/Dockerfile.notebookRun the following command to start the JupyterHub server:
bash start_jupyterhub.shWhen running the script, you will be prompted to enter the following environment variables:
- NGROK_AUTH: This is necessary because the JupyterHub uses the ngrok service to obtain a public domain. To get an authenticated token, you must log in to the ngrok dashboard.
- HOST_PERSONAL_NETWORK_FOLDER: This variable is used to mount your personal folder volume to your JupyterHub server.
- HOST_SHARED_NETWORK_FOLDER: This variable is used to mount your shared folder volume to your JupyterHub server.
After running the script successfully, you can get the JupyterHub server public domain at http://<your-ip>:4551 (if you are running it locally, replace <your-ip> with localhost). Alternatively, you can access it through the native port https://<your-ip>:443 and log in with the administrator username/password admin/admin.
Note: Remember to change the userlist file to include your username and password. You can add users to the list using the following example:
admin admin
user1 user1
user2 user2
- Volume
jupyterhub-db-dataorjupyterhub-datanot found.
docker volume create --name="jupyterhub-data"- Network
jupyterhub-networknot found.
docker network create "jupyterhub-network"By following these steps, you will have a fully-functional JupyterHub and VS Code server with GPU access. If you encounter any issues, please refer to the common issues section for more information.