-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui.sh
executable file
·86 lines (73 loc) · 1.98 KB
/
gui.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
# dstat-interface-cli.sh
set -e
DOCKER_IMAGE_NAME="dstat-interface"
DOCKER_CONTAINER_NAME="dstat-interface-container"
function show_help {
echo "Usage: $0 [OPTION]"
echo "Manage dstat-interface Docker container"
echo ""
echo "Options:"
echo " build Build the Docker image"
echo " run Run the Docker container"
echo " debug Run the Docker container in interactive mode"
echo " stop Stop the running container"
echo " clean Remove the Docker image and container"
echo " help Show this help message"
}
function build_image {
echo "Building Docker image..."
docker build -t $DOCKER_IMAGE_NAME .
}
function run_container {
echo "Setting up X11 forwarding..."
xhost + 127.0.0.1
echo "Running Docker container..."
docker run -d --name $DOCKER_CONTAINER_NAME \
-e DISPLAY=host.docker.internal:0 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
--rm $DOCKER_IMAGE_NAME
echo "Container is running. Use 'docker logs $DOCKER_CONTAINER_NAME' to view output."
}
function debug_container {
echo "Setting up X11 forwarding..."
xhost + 127.0.0.1
echo "Running Docker container in interactive mode..."
docker run -it --name $DOCKER_CONTAINER_NAME \
-e DISPLAY=host.docker.internal:0 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
--rm $DOCKER_IMAGE_NAME /bin/bash
}
function stop_container {
echo "Stopping Docker container..."
docker stop $DOCKER_CONTAINER_NAME
}
function clean_up {
echo "Removing Docker container and image..."
docker rm -f $DOCKER_CONTAINER_NAME 2>/dev/null || true
docker rmi -f $DOCKER_IMAGE_NAME 2>/dev/null || true
}
case "$1" in
build)
build_image
;;
run)
run_container
;;
debug)
debug_container
;;
stop)
stop_container
;;
clean)
clean_up
;;
help)
show_help
;;
*)
show_help
exit 1
;;
esac