Skip to content

Instantly share code, notes, and snippets.

@aic25
Created April 18, 2019 05:35
Show Gist options
  • Save aic25/6b1aac71ad8288748dc4dadb289ff871 to your computer and use it in GitHub Desktop.
Save aic25/6b1aac71ad8288748dc4dadb289ff871 to your computer and use it in GitHub Desktop.
Create container from image
#!/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