-
Notifications
You must be signed in to change notification settings - Fork 3
/
check.sh
executable file
·29 lines (23 loc) · 1.13 KB
/
check.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
#!/bin/bash
# Specify the container name
CONTAINER_NAME="drims2"
IMAGE_NAME="smentasti/drims2"
# Pull the latest image
echo "Pulling the latest image: $IMAGE_NAME..."
docker pull $IMAGE_NAME
# Check if the container exists
if docker ps -a | grep -q $CONTAINER_NAME; then
echo "Container $CONTAINER_NAME exists."
# Check if the container is running
if [ "$(docker inspect -f {{.State.Running}} $CONTAINER_NAME)" == "true" ]; then
echo "Container $CONTAINER_NAME is running. Stopping it now..."
docker stop $CONTAINER_NAME
docker rm $CONTAINER_NAME
else
echo "Container $CONTAINER_NAME is not running."
docker rm $CONTAINER_NAME
fi
else
echo "Container $CONTAINER_NAME does not exist."
fi
docker run -it --user drims -v /dev:/dev -v /dev/bus/usb:/dev/bus/usb --device=/dev/bus/usb --device-cgroup-rule='c 189:* rmw' -v /etc/udev/rules.d:/etc/udev/rules.d --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --net=host --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" --volume="$(pwd)/drims_ws:/home/drims/drims_ws" --volume="$(pwd)/bags:/bags" --name drims2 -w /home/drims $IMAGE_NAME /check_script.sh