-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker_run.sh
64 lines (58 loc) · 1.68 KB
/
docker_run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
CONTAINER_NAME="ddqn_bin_picking"
# Check if given input arguments
if [ $# -eq 0 ]
then
echo -e "\033[1;31mNo input arguments given, exiting...\033[0m"
return
fi
xhost +local:docker
if [ "$1" == "same" ]
then
docker exec -it --privileged ${CONTAINER_NAME} bash
exit
fi
# Check if valid cuda version
if [ `echo $LD_LIBRARY_PATH | grep -c "cuda-9.*" ` -gt 0 ]
then
echo -e "\033[1;35mFind Cuda version 9\033[0m"
CUDA_TAG="cuda9.0"
elif [ `echo $LD_LIBRARY_PATH | grep -c "cuda-10.*" ` -gt 0 ]
then
echo -e "\033[1;35mFind Cuda version 10\033[0m"
CUDA_TAG="cuda10.0"
fi
# Check if $CUDA_TAG set
if [ -z "$CUDA_TAG" ]
then
echo -e "\033[1;31mInvalid Cuda version (we only provided with version 9.* and 10.*) or no Cuda Installed\033[0m"
return
fi
if [[ "$1" == "run" ]]
then
echo -e "\033[1;33mOpening container with name ${CONTAINER_NAME}\033[0m"
docker run --name ${CONTAINER_NAME} --rm -it --net=host --privileged -v /dev:/dev \
--env="DISPLAY"="$DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
-v /etc/localtime:/etc/localtime:ro \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp/.X11-unix/:/tmp/.X11-unix \
-v $PWD/:/home/$USER/rl_pnp \
-v /home/$USER/Documents/:/home/$USER/Documents \
--env "XAUTHORITY=$XAUTH" \
--env USER=$USER \
-v "XAUTHORITY=$XAUTH" \
--runtime=nvidia \
--device=/dev/dri:/dev/dri \
--device=/dev/nvhost-gpu \
--device=/dev/nvhost-as-gpu \
--device=/dev/nvhost-ctrl \
--device=/dev/nvhost-ctrl-gpu \
--device=/dev/nvhost-prof-gpu \
--device=/dev/nvmap \
--device=/dev/ttyUSB* \
--device=/dev/ttyACM* \
-v /dev/bus/usb:/dev/bus/usb \
-w /home/$USER/rl_pnp \
sean85914/ddqn_bin_picking:${CUDA_TAG} bash
fi