Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Commit

Permalink
Improve pass-through of docker arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
flx42 committed Feb 23, 2018
1 parent 4edca2f commit 2e9f20b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions nvidia-docker
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#! /bin/bash
# Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.

NV_DOCKER=${NV_DOCKER:-"docker"}

DOCKER_ARGS=""
NV_DOCKER_ARGS=""
DOCKER_ARGS=()
NV_DOCKER_ARGS=()
while [ $# -gt 0 ]; do
arg=$1
shift
DOCKER_ARGS="$DOCKER_ARGS $arg"
DOCKER_ARGS+=("$arg")
case $arg in
run|create)
NV_DOCKER_ARGS="--runtime=nvidia"
if [ ! -z $NV_GPU ]; then
NV_DOCKER_ARGS="$NV_DOCKER_ARGS -e NVIDIA_VISIBLE_DEVICES=${NV_GPU// /,}"
NV_DOCKER_ARGS+=("--runtime=nvidia")
if [ ! -z "${NV_GPU}" ]; then
NV_DOCKER_ARGS+=(-e NVIDIA_VISIBLE_DEVICES="${NV_GPU// /,}")
fi
break
;;
Expand All @@ -31,4 +31,4 @@ if [ ! -z $NV_DEBUG ]; then
set -x
fi

$NV_DOCKER $DOCKER_ARGS $NV_DOCKER_ARGS "$@"
exec $NV_DOCKER "${DOCKER_ARGS[@]}" "${NV_DOCKER_ARGS[@]}" "$@"

0 comments on commit 2e9f20b

Please sign in to comment.