Skip to content

Commit 3e7e2cf

Browse files
committed
Docker: Fix non-root execution issues. Remove 'set -eu' from user-setup.bash since it's sourced via BASH_ENV and affects all subsequent scripts. Use safe parameter expansion in jupyter-start.bash. Configure nsight service to start as root but switch to HOST_UID via USER environment variable. Add USER to common-service environment block for all containers.
1 parent cbf0c54 commit 3e7e2cf

File tree

7 files changed

+14
-3
lines changed

7 files changed

+14
-3
lines changed

brev/jupyter-start.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mkdir -p /accelerated-computing-hub/logs
88
# Set the preferred directory to the current working directory, which is set by Docker Compose.
99
ARGS="--ServerApp.preferred_dir=${PWD:-/}"
1010

11-
if [ -n "${1}" ]; then
11+
if [ -n "${1:-}" ]; then
1212
ARGS="--LabApp.default_url=${1}"
1313
fi
1414

brev/user-setup.bash

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
# - Running as a custom UID/GID passed via HOST_UID/HOST_GID
99
#
1010
# This script is sourced by entrypoint scripts to set up the environment.
11-
12-
set -eu
11+
#
12+
# NOTE: Do not use 'set -eu' here as this script is sourced via BASH_ENV
13+
# and would affect all subsequent scripts.
1314

1415
# Get current user info
1516
CURRENT_UID=$(id -u)

tutorials/accelerated-python/brev/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ x-config:
2727
BREV_ENV_ID: ${BREV_ENV_ID:-}
2828
ACH_TUTORIAL: *tutorial-name
2929
ACH_RUN_TESTS: ${ACH_RUN_TESTS:-}
30+
USER: "${HOST_UID:-1000}"
3031
user: "${HOST_UID:-1000}:${HOST_GID:-1000}"
3132
working_dir: *working-dir
3233
persistent-service: &persistent-service
@@ -54,6 +55,7 @@ services:
5455
<<: [*gpu-config, *common-service, *persistent-service]
5556
image: nvcr.io/nvidia/devtools/nsight-streamer-nsys:2025.3.1
5657
entrypoint: ["/accelerated-computing-hub/brev/nsight-start.bash"]
58+
user: root
5759
ports:
5860
- "0.0.0.0:8080:8080" # HTTP
5961
- "0.0.0.0:3478:3478" # TURN

tutorials/cuda-cpp/brev/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ x-config:
2626
BREV_ENV_ID: ${BREV_ENV_ID:-}
2727
ACH_TUTORIAL: *tutorial-name
2828
ACH_RUN_TESTS: ${ACH_RUN_TESTS:-}
29+
USER: "${HOST_UID:-1000}" # Nsight streamer switches to this user internally
2930
user: "${HOST_UID:-1000}:${HOST_GID:-1000}"
3031
working_dir: *working-dir
3132
persistent-service: &persistent-service
@@ -52,6 +53,7 @@ services:
5253
<<: [*gpu-config, *common-service, *persistent-service]
5354
image: nvcr.io/nvidia/devtools/nsight-streamer-nsys:2025.3.1
5455
entrypoint: ["/accelerated-computing-hub/brev/nsight-start.bash"]
56+
user: root
5557
ports:
5658
- "0.0.0.0:8080:8080" # HTTP
5759
- "0.0.0.0:3478:3478" # TURN

tutorials/cuda-tile/brev/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ x-config:
2727
BREV_ENV_ID: ${BREV_ENV_ID:-}
2828
ACH_TUTORIAL: *tutorial-name
2929
ACH_RUN_TESTS: ${ACH_RUN_TESTS:-}
30+
USER: "${HOST_UID:-1000}"
3031
user: "${HOST_UID:-1000}:${HOST_GID:-1000}"
3132
working_dir: *working-dir
3233
persistent-service: &persistent-service
@@ -54,6 +55,7 @@ services:
5455
<<: [*gpu-config, *common-service, *persistent-service]
5556
image: nvcr.io/nvidia/devtools/nsight-streamer-nsys:2025.3.1
5657
entrypoint: ["/accelerated-computing-hub/brev/nsight-start.bash"]
58+
user: root
5759
ports:
5860
- "0.0.0.0:8080:8080" # HTTP
5961
- "0.0.0.0:3478:3478" # TURN

tutorials/nvmath-python/brev/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ x-config:
2727
BREV_ENV_ID: ${BREV_ENV_ID:-}
2828
ACH_TUTORIAL: *tutorial-name
2929
ACH_RUN_TESTS: ${ACH_RUN_TESTS:-}
30+
USER: "${HOST_UID:-1000}"
3031
user: "${HOST_UID:-1000}:${HOST_GID:-1000}"
3132
working_dir: *working-dir
3233
persistent-service: &persistent-service
@@ -53,6 +54,7 @@ services:
5354
<<: [*gpu-config, *common-service, *persistent-service]
5455
image: nvcr.io/nvidia/devtools/nsight-streamer-nsys:2025.3.1
5556
entrypoint: ["/accelerated-computing-hub/brev/nsight-start.bash"]
57+
user: root
5658
ports:
5759
- "0.0.0.0:8080:8080" # HTTP
5860
- "0.0.0.0:3478:3478" # TURN

tutorials/stdpar/brev/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ x-config:
2727
BREV_ENV_ID: ${BREV_ENV_ID:-}
2828
ACH_TUTORIAL: *tutorial-name
2929
ACH_RUN_TESTS: ${ACH_RUN_TESTS:-}
30+
USER: "${HOST_UID:-1000}"
3031
user: "${HOST_UID:-1000}:${HOST_GID:-1000}"
3132
working_dir: *working-dir
3233
persistent-service: &persistent-service
@@ -53,6 +54,7 @@ services:
5354
<<: [*gpu-config, *common-service, *persistent-service]
5455
image: nvcr.io/nvidia/devtools/nsight-streamer-nsys:2025.3.1
5556
entrypoint: ["/accelerated-computing-hub/brev/nsight-start.bash"]
57+
user: root
5658
ports:
5759
- "0.0.0.0:8080:8080" # HTTP
5860
- "0.0.0.0:3478:3478" # TURN

0 commit comments

Comments
 (0)