From 0dea628033f2d779da00ab2fc905a0cb6140fa61 Mon Sep 17 00:00:00 2001 From: John Meyer <0x326@users.noreply.github.com> Date: Tue, 26 Jan 2021 15:14:29 -0500 Subject: [PATCH] Set NB_UID and NB_GID variables --- README.md | 2 +- docker-compose.yml | 2 ++ start-local.sh | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4d92e4d..6313c92 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ with the default password `asdf`. # generate a Dockerfile with python and without Julia and R ./generate-Dockerfile.sh --no-datascience-notebook 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` diff --git a/docker-compose.yml b/docker-compose.yml index 084f5b2..dd61b0a 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,8 @@ services: environment: GRANT_SUDO: "yes" JUPYTER_ENABLE_LAB: "yes" + NB_UID: '${UID}' + NB_GID: '${GID}' # enable sudo permissions user: "root" diff --git a/start-local.sh b/start-local.sh index 23cccfe..2136c0c 100755 --- a/start-local.sh +++ b/start-local.sh @@ -19,6 +19,8 @@ fi # starting in docker-compose echo "Starting gpu-jupyter via docker-compose on port $PORT." export JUPYTER_PORT=$PORT +export UID=$(id -u) +export GID=$(id -g) # echo $JUPYTER_PORT docker-compose up --build -d