-
Notifications
You must be signed in to change notification settings - Fork 210
/
run2.sh
executable file
·45 lines (37 loc) · 1.01 KB
/
run2.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
#!/bin/bash
# For generating/running a Dockerfile image based on Python 2
# Note: Python 2 is no longer officially supported and this Docker image will
# probably stop working eventually...
#from: https://unix.stackexchange.com/a/129401
while getopts ":d:p:" opt; do
case $opt in
d) duration="$OPTARG"
;;
p) p_out="$OPTARG"
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
done
OW_OUT_DIR=/home/ow/shared
HOST_OUT_DIR=$PWD
version=$(<VERSION) # Read version of Dockerfile from file VERSION
xhost +
if [ -z "$duration" ]
then #duration is not set, don't use it
DURATION_PART=""
else #Duration is set, use it.
DURATION_PART="-e DURATION=$duration"
fi
docker run -d \
--name openworm2_$version \
--device=/dev/dri:/dev/dri \
-e DISPLAY=$DISPLAY \
$DURATION_PART \
-e OW_OUT_DIR=$OW_OUT_DIR \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
--privileged \
-v $HOST_OUT_DIR:$OW_OUT_DIR:rw \
openworm/openworm:${version}_py2 \
bash -c "DISPLAY=:44 python master_openworm.py"
docker logs -f openworm2_$version