-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathstart_container.sh
executable file
·33 lines (25 loc) · 983 Bytes
/
start_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
#!/bin/bash
SCRIPT_DIR=$(cd $(dirname "$0") && pwd)
cd $SCRIPT_DIR/files
CONTAINER_NAME="development-container-for-ros-2-on-m1-2-mac_for_${USER}_container"
if [ "$(docker ps -al | grep ${CONTAINER_NAME})" ]; then
echo "docker container restarting..."
CONTAINER_ID=$(docker ps -a -f name=${CONTAINER_NAME} --format "{{.ID}}")
sudo rm -rf /tmp/.docker.xauth
XAUTH=/tmp/.docker.xauth
touch $XAUTH
xauth_list=$(xauth nlist :0 | sed -e 's/^..../ffff/')
if [ ! -z "$xauth_list" ]; then
echo $xauth_list | xauth -f $XAUTH nmerge -
fi
chmod a+r $XAUTH
docker start $CONTAINER_ID
echo "_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/"
echo "_/ Plese access your container via RDP Client _/"
echo "_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/"
exit
fi
nohup ./launch_container.sh xrdp >/tmp/nohup.out 2>&1 &
echo "_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/"
echo "_/ Plese access localhost by RDP Client!! _/"
echo "_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/"