-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun
More file actions
executable file
·27 lines (24 loc) · 765 Bytes
/
run
File metadata and controls
executable file
·27 lines (24 loc) · 765 Bytes
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
#! /bin/bash
DOCKER_IMAGE=graphics_docker
CONTAINER_NAME=test-graphics-docker
echo "Checking if $DOCKER_IMAGE docker image exists..."
if [[ "$(docker images -q $DOCKER_IMAGE 2> /dev/null)" == "" ]]; then
echo "Image does not exist. Building it..."
docker build -t $DOCKER_IMAGE .
else
echo "Image exists."
fi
if [[ $(docker start $CONTAINER_NAME 2> /dev/null) ]]; then
echo "$CONTAINER_NAME docker container exist. Connecting to the environment..."
docker exec -it $CONTAINER_NAME /bin/bash
else
echo "$CONTAINER_NAME container doesn't exist. Starting the environment..."
docker run -it \
--name $CONTAINER_NAME \
-v $(pwd):/test \
--env DISPLAY=:0 \
-p 6080:6080 \
-w /test \
$DOCKER_IMAGE \
/bin/bash
fi