forked from IRSL-tut/docker_mediapipe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·66 lines (53 loc) · 1.72 KB
/
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
65
66
#!/bin/bash
#iname=${DOCKER_IMAGE:-"docker_mediapipe"} ##
iname=${DOCKER_IMAGE:-"docker_mediapipe"} ##
cname=${DOCKER_CONTAINER:-"docker_mediapipe"} ## name of container (should be same as in exec.sh)
DEFAULT_USER_DIR="$(pwd)/src"
mtdir=${MOUNTED_DIR:-$DEFAULT_USER_DIR}
VAR=${@:-"bash"}
if [ $# -eq 0 -a -z "$OPT" ]; then
OPT=-it
fi
if [ -z "$NO_GPU" ]; then
GPU_OPT='--gpus all,"capabilities=compute,graphics,utility,display"'
else
GPU_OPT=""
fi
#echo "GPU_OPT: $GPU_OPT"
## --net=mynetworkname
## docker inspect -f '{{.NetworkSettings.Networks.mynetworkname.IPAddress}}' container_name
## docker inspect -f '{{.NetworkSettings.Networks.mynetworkname.Gateway}}' container_name
NET_OPT="--net=host"
# for gdb
#NET_OPT="--net=host --env=DOCKER_ROS_IP --env=DOCKER_ROS_MASTER_URI --cap-add=SYS_PTRACE --security-opt=seccomp=unconfined"
DOCKER_ENVIRONMENT_VAR=""
if [ -n "$USE_USER" ]; then
USER_SETTING=" -u $(id -u):$(id -g) -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro"
fi
xhost +local:root
# xhost +si:localuser:root
rmimage=$(docker rm ${cname})
docker run \
--privileged \
${OPT} \
${GPU_OPT} \
${NET_OPT} \
${USER_SETTING} \
${DOCKER_ENVIRONMENT_VAR} \
--env="DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--name=${cname} \
--volume="${mtdir}:/src" \
-w="/src" \
${iname} \
${VAR}
##xhost -local:root
## capabilities
# compute CUDA / OpenCL アプリケーション
# compat32 32 ビットアプリケーション
# graphics OpenGL / Vulkan アプリケーション
# utility nvidia-smi コマンドおよび NVML
# video Video Codec SDK
# display X11 ディスプレイに出力
# all