-
Notifications
You must be signed in to change notification settings - Fork 593
/
enter
executable file
·32 lines (26 loc) · 1.01 KB
/
enter
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
#!/bin/bash
# enter the container with a new bash session, separate from the supervisord session
# If you wanna run supervisord, use start
# copy keys file if not already exist
BIN_DIR=`pwd`/bin
$BIN_DIR/copy-config
if [[ $1 && $1=='production' ]]; then
container=aiva-production
else
container=aiva-development
fi
if [[ "$(docker images -qa kengz/aiva:latest 2> /dev/null)" != "" ]]; then
if [[ "$(docker ps -qa --filter name=$container 2> /dev/null)" != "" ]]; then
if [[ $1 && $1=='production' ]]; then
echo "[ Production: Docker container '$container' exists; enter with new bash session ]"
else
echo "[ Development: Docker container '$container' exists; enter with new bash session ]"
fi
echo "[ -------- Use Ctrl-p-q to detach bash session -------- ]\n"
docker start $container && docker exec -it $container /bin/bash
else
echo "[ Docker container '$container' does not exist. Start it first. ]"
fi
else
echo "[Docker container $container not found; start it first]"
fi