From 3740db3bbcee1d0b4c3d38afff56277030d50340 Mon Sep 17 00:00:00 2001 From: toor Date: Sun, 29 Dec 2024 11:00:10 -0500 Subject: [PATCH] Working on Orin locally with matplotlib --- README.md | 20 ++++++++++++++++++ docker-compose-jupyterlab.yaml | 29 +++++++++++++++++++++++++++ docker/Dockerfile.jupyterlab-extended | 4 ++++ docker/README.md | 4 ++++ jupyterlab.service | 16 +++++++++++++++ 5 files changed, 73 insertions(+) create mode 100644 docker-compose-jupyterlab.yaml create mode 100644 docker/Dockerfile.jupyterlab-extended create mode 100644 docker/README.md create mode 100644 jupyterlab.service diff --git a/README.md b/README.md index 1f5f7c3..7e8a0a7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,22 @@ # jetson-jupyterlab +Simple hosting of Jupyterlab on Jetson Orin + +## Install + +If you are ever using a Jetpack version that doesn't have pre-built images yet, you will want to install https://github.com/dusty-nv/jetson-containers and use the commands to build your own docker containers. + +This repo simply hosts a docker-compose file and a systemd service file to ensure the docker-compose services are started on boot. + + +``` +sudo mkdir -p /opt/jupyterlab +sudo cp docker-compose-jupyterlab.yaml /opt/jupyterlab/docker-compose-jupyterlab.yaml +``` + +``` +sudo cp jupyterlab.service /etc/systemd/system/jupyterlab.service +sudo systemctl enable jupyterlab.service +sudo systemctl start jupyterlab.service +``` + diff --git a/docker-compose-jupyterlab.yaml b/docker-compose-jupyterlab.yaml new file mode 100644 index 0000000..a959c1e --- /dev/null +++ b/docker-compose-jupyterlab.yaml @@ -0,0 +1,29 @@ +version: '3' + +services: + jupyterlab: + # image: androiddrew/jupyterlab:r36.4.0 + image: androiddrew/jupyterlab:r36.4.0-extended + runtime: nvidia + ports: + - 18888:8888 + command: + - "/bin/sh" + - "-c" + - "/start_jupyter && sleep infinity" + environment: + # - JUPYTER_ROOT=/jupyterlab + - JUPYTER_PORT=8888 + - JUPYTER_LOGS=/jupyterlab/jupyterlab.log + - JUPYTER_PASSWORD=notebooks + volumes: + - /opt/jupyterlab/:/jupyterlab + - /opt/jupyterlab/data:/data + restart: unless-stopped + networks: + - jupyter-docker + +networks: + jupyter-docker: + external: false + diff --git a/docker/Dockerfile.jupyterlab-extended b/docker/Dockerfile.jupyterlab-extended new file mode 100644 index 0000000..592bf96 --- /dev/null +++ b/docker/Dockerfile.jupyterlab-extended @@ -0,0 +1,4 @@ +FROM androiddrew/jupyterlab:r36.4.0 + +RUN pip install matplotlib + diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..5b9fd4b --- /dev/null +++ b/docker/README.md @@ -0,0 +1,4 @@ +# Building and extended image with additional dependencies + +docker build --tag androiddrew/jupyterlab:r36.4.0-extended -f Dockerfile.jupyterlab-extended . + diff --git a/jupyterlab.service b/jupyterlab.service new file mode 100644 index 0000000..722ff8b --- /dev/null +++ b/jupyterlab.service @@ -0,0 +1,16 @@ +[Unit] +Description=Jupyterlab Notebook Service +Requires=docker.service +After=docker.service + +[Service] +Type=oneshot +RemainAfterExit=yes +WorkingDirectory=/opt/jupyterlab +ExecStartPre=/bin/sh -c 'echo JUPYTERLAB_HOSTNAME=$(hostname) > /opt/jupyterlab/.env' +ExecStart=docker compose --env-file /opt/jupyterlab/.env -f /opt/jupyterlab/docker-compose-jupyterlab.yaml up -d +ExecStop=docker compose -f /opt/jupyterlab/docker-compose-jupyterlab.yaml down + +[Install] +WantedBy=multi-user.target +