-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.bash
More file actions
28 lines (21 loc) · 873 Bytes
/
setup.bash
File metadata and controls
28 lines (21 loc) · 873 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
IMAGE_NAME=ros-$DISTRO
CONTAINER_NAME=$IMAGE_NAME
COUNT=$(docker ps | grep "$CONTAINER_NAME" | wc -l)
if [ "$COUNT" -eq 0 ]; then
image_exists=$(docker images -q "$IMAGE_NAME")
if [ -z "$image_exists" ]; then
rocker --nvidia --x11 --user --home --nocleanup \
--image-name $IMAGE_NAME \
--name $CONTAINER_NAME \
osrf/ros:$TAG
else
docker run -it -v /home/$USER:/home/$USER --name $CONTAINER_NAME \
--gpus all -e DISPLAY -e TERM -e QT_X11_NO_MITSHM=1 \
-e XAUTHORITY=/tmp/.$IMAGE_NAME.xauth -v /tmp/.$IMAGE_NAME.xauth:/tmp/.$IMAGE_NAME.xauth \
-v /tmp/.X11-unix:/tmp/.X11-unix -v /etc/localtime:/etc/localtime:ro $IMAGE_NAME
fi
docker commit $CONTAINER_NAME $IMAGE_NAME
docker container remove $CONTAINER_NAME
else
docker exec -it "$CONTAINER_NAME" bash -c "source /opt/ros/$DISTRO/setup.bash && bash"
fi