Set NB_UID and NB_GID variables

This commit is contained in:
John Meyer 2021-01-26 15:14:29 -05:00
parent 03392f4136
commit 0dea628033
3 changed files with 5 additions and 1 deletions

View File

@ -92,7 +92,7 @@ with the default password `asdf`.
# generate a Dockerfile with python and without Julia and R # generate a Dockerfile with python and without Julia and R
./generate-Dockerfile.sh --no-datascience-notebook ./generate-Dockerfile.sh --no-datascience-notebook
docker build -t gpu-jupyter .build/ # will take a while docker build -t gpu-jupyter .build/ # will take a while
docker run --gpus all -d -it -p 8848:8888 -v $(pwd)/data:/home/jovyan/work -e GRANT_SUDO=yes -e JUPYTER_ENABLE_LAB=yes --user root --restart always --name gpu-jupyter_1 gpu-jupyter docker run --gpus all -d -it -p 8848:8888 -v $(pwd)/data:/home/jovyan/work -e GRANT_SUDO=yes -e JUPYTER_ENABLE_LAB=yes -e NB_UID="$(id -u)" -e NB_GID="$(id -g)" --user root --restart always --name gpu-jupyter_1 gpu-jupyter
``` ```
This starts a container WITH GPU support, a shared local data volume `data` This starts a container WITH GPU support, a shared local data volume `data`

View File

@ -9,6 +9,8 @@ services:
environment: environment:
GRANT_SUDO: "yes" GRANT_SUDO: "yes"
JUPYTER_ENABLE_LAB: "yes" JUPYTER_ENABLE_LAB: "yes"
NB_UID: '${UID}'
NB_GID: '${GID}'
# enable sudo permissions # enable sudo permissions
user: user:
"root" "root"

View File

@ -19,6 +19,8 @@ fi
# starting in docker-compose # starting in docker-compose
echo "Starting gpu-jupyter via docker-compose on port $PORT." echo "Starting gpu-jupyter via docker-compose on port $PORT."
export JUPYTER_PORT=$PORT export JUPYTER_PORT=$PORT
export UID=$(id -u)
export GID=$(id -g)
# echo $JUPYTER_PORT # echo $JUPYTER_PORT
docker-compose up --build -d docker-compose up --build -d