Created
April 18, 2019 05:35
-
-
Save aic25/6b1aac71ad8288748dc4dadb289ff871 to your computer and use it in GitHub Desktop.
Create container from image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#xhost + | |
usage () | |
{ | |
echo "kwargs : $0 <$1:docker image> <$2:container name> <$3:port to open>" | |
exit | |
} | |
if [ "$#" -ne 3 ] | |
then | |
usage | |
fi | |
sudo nvidia-docker run \ | |
-it --rm -p $3:8888 \ | |
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \ | |
-e DISPLAY=$DISPLAY \ | |
-e NVIDIA_DRIVER_CAPABILITIES=compute,utility,video \ | |
-e NVIDIA_VISIBLE_DEVICES=all \ | |
-v $HOME:/root \ | |
--name=$2 \ | |
$1 | |
# --privileged \ | |
# --volume="$HOME/.Xauthority:/root/.Xauthority:rw" \ | |
# --device /dev/video0:/dev/video0:mwr \ | |
# --device /dev/video1:/dev/video1:mwr \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment