-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathautorun.sh
executable file
·46 lines (40 loc) · 1.15 KB
/
autorun.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
image_name=lihanchen2004/ogm2pgbm:latest
instance_name=ogm2pgbm
check_docker_instance_already_running() {
if [ ! "$(docker ps -a | grep $instance_name)" ]; then
return 0
fi
return 1
}
delete_running_docker_instance() {
if ! docker container rm --force "${instance_name}"; then
return 1
fi
return 0
}
simulation_main() {
xhost +local:docker # allow window
if ! check_docker_instance_already_running; then
if ! delete_running_docker_instance; then
return 1
fi
fi
# docker build -t $image_name .
docker run -it --rm \
--name $instance_name \
--gpus all \
--env NVIDIA_DRIVER_CAPABILITIES=all \
--env DISPLAY=${DISPLAY} \
--env QT_X11_NO_MITSHM=1 \
--device=/dev/dri \
--group-add video \
--device=/dev/snd:/dev/snd \
--group-add audio \
--net=host \
--privileged \
--volume /tmp/.X11-unix:/tmp/.X11-unix \
--volume="$HOME/.Xauthority:/root/.Xauthority" \
--volume="$(pwd)/workspace:/root/workspace" \
$image_name /bin/zsh
}
simulation_main