-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart_docker.sh
41 lines (37 loc) · 1.09 KB
/
start_docker.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
#!/bin/bash
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
NC='\033[0m' # No Color
is_image_build() {
if [ "$(docker images -q aip_coordinator/ros:humble 2> /dev/null)" == "" ]; then
echo -e "${RED}Image not found. Have you built the image?${NC}"
echo -e "${BLUE}Try running: ./build_docker.sh${NC}"
return 1
else
echo -e "${GREEN}Image found.${NC}"
return 0
fi
}
run_docker() {
is_image_build
if [ $? -eq 0 ]; then
echo -e "${YELLOW}Running docker...${NC}"
xhost +local:root
docker run \
--name aip_coordinator \
-it \
--net host \
-e DISPLAY=$DISPLAY \
--env-file .env \
--rm \
-v "${PWD}/aip_coordinator:/home/docker/ros2_ws/src/aip_coordinator" \
-v "${PWD}/aip_interfaces:/home/docker/ros2_ws/src/aip_interfaces" \
-v "${PWD}/.vscode:/home/docker/ros2_ws/src/.vscode" \
aip_coordinator/ros:humble
# ros2 run groot Groot
fi
}
run_docker