File size: 795 Bytes
4738a88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env bash
## Assumes you have docker installed with nvidia container container-toolkit
# https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/1.13.5/install-guide.html
# sudo apt-get install -y nvidia-container-toolkit-base || yay -Syu nvidia-container-toolkit || echo etc...
## Try to start an existing container otherwise create a new one
docker start jupyter 2> /dev/null || \
docker run -it \
    -d \
    --gpus all \
    -p 8888:8888 \
    --name jupyter \
    --user root \
    -e NB_USER="$USER" \
    -e CHOWN_HOME=yes \
    -e GRANT_SUDO=yes \
    -w "/home/${NB_USER}" \
    -v "$PWD":"/home/$USER/work" \
    jupyter/base-notebook

## `docker logs jupyter` to get the URL link and token e.g.
## http://127.0.0.1:8888/lab?token=blahblahblahblabhlaabhalbhalbhal