File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ INTERACTIVE=
4343USE_NIXL_GDS=
4444RUNTIME=nvidia
4545WORKDIR=/workspace
46+ USER=
4647
4748get_options () {
4849 while : ; do
@@ -124,6 +125,14 @@ get_options() {
124125 missing_requirement " $1 "
125126 fi
126127 ;;
128+ --user)
129+ if [ " $2 " ]; then
130+ USER=" $2 "
131+ shift
132+ else
133+ missing_requirement " $1 "
134+ fi
135+ ;;
127136 --privileged)
128137 if [ " $2 " ]; then
129138 PRIVILEGED=$2
@@ -274,6 +283,12 @@ get_options() {
274283 RM_STRING=" --rm "
275284 fi
276285
286+ if [[ ${USER} == " " ]]; then
287+ USER_STRING=" "
288+ else
289+ USER_STRING=" --user ${USER} "
290+ fi
291+
277292 if [ -n " $USE_NIXL_GDS " ]; then
278293 VOLUME_MOUNTS+=" -v /run/udev:/run/udev:ro "
279294 NIXL_GDS_CAPS=" --cap-add=IPC_LOCK"
@@ -310,6 +325,7 @@ show_help() {
310325 echo " [-- stop processing and pass remaining args as command to docker run]"
311326 echo " [--workdir set the working directory inside the container]"
312327 echo " [--runtime add runtime variables]"
328+ echo " [--user override the user for running the container]"
313329 exit 0
314330}
315331
@@ -347,6 +363,7 @@ ${RUN_PREFIX} docker run \
347363 ${NIXL_GDS_CAPS} \
348364 --ipc host \
349365 ${PRIVILEGED_STRING} \
366+ ${USER_STRING} \
350367 ${NAME_STRING} \
351368 ${ENTRYPOINT_STRING} \
352369 ${IMAGE} \
You can’t perform that action at this time.
0 commit comments