-
Notifications
You must be signed in to change notification settings - Fork 14
/
REALTIME-DOCKER-CONTAINER.sh
executable file
·43 lines (36 loc) · 1.42 KB
/
REALTIME-DOCKER-CONTAINER.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
#!/bin/bash
################################################################################
# Set the Docker container name from a project name (first argument).
# If no argument is given, use the current user name as the project name.
PROJECT=$1
if [ -z "${PROJECT}" ]; then
PROJECT=${USER}
fi
CONTAINER="${PROJECT}_o2ac-ur_1"
echo "$0: PROJECT=${PROJECT}"
echo "$0: CONTAINER=${CONTAINER}"
# Run the Docker container in the background.
# Any changes made to './docker/docker-compose.yml' will recreate and overwrite the container.
docker-compose -p ${PROJECT} -f ./docker/docker-compose-realtime.yml up -d
################################################################################
# Display GUI through X Server by granting full access to any external client.
xhost +
################################################################################
# Enter the Docker container with a Bash shell (with or without a custom).
case "$3" in
( "" )
case "$2" in
( "" )
docker exec -i -t ${CONTAINER} bash
;;
( * )
docker exec -i -t ${CONTAINER} bash -i -c "~/o2ac-ur/docker/o2ac-dev/scripts/run-command-repeatedly.sh $2"
esac
;;
( *".launch")
docker exec -i -t ${CONTAINER} bash -i -c "~/o2ac-ur/docker/o2ac-dev/scripts/run-roslaunch-repeatedly.sh $2 $3"
;;
( * )
echo "Failed to enter the Docker container '${CONTAINER}': '$3' is not a valid argument value (needs to be a launch file or empty)."
;;
esac