forked from gnap114039/thinkorswim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
executable file
·28 lines (26 loc) · 1.05 KB
/
run
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
#! /bin/bash
#if [ ! "$(docker image inspect -f '{{.Id}}' gnap114039/thinkorswim)" ]; then
# # echo "No image name thinkorswim was found, start building image......"
# # docker build -t thinkorswim .
# echo "No image name thinkorswim was found, start pulling image......"
# docker pull gnap114039/thinkorswim
#fi
xhost +local:root
if [ ! "$(docker ps -a | grep gnap114039/thinkorswim)" ]; then
echo "No container thinkorswim was found. Creating new container ......"
docker run -td --name thinkorswim\
--net=host \
--env="DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
gnap114039/thinkorswim:latest
docker exec thinkorswim ./thinkorswim
exit 0
elif [ "$(docker container inspect -f '{{.State.Status}}' gnap114039/thinkorswim)" == "running" ]; then
docker exec thinkorswim ./thinkorswim
exit 0
elif [ "$(docker container inspect -f '{{.State.Status}}' gnap114039/thinkorswim)" == "exited" ]; then
docker start thinkorswim
docker exec thinkorswim ./thinkorswim
exit 0
fi