-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcnt-create-oracle-xe-server
executable file
·51 lines (39 loc) · 1.42 KB
/
cnt-create-oracle-xe-server
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
#!/usr/bin/env bash
# Variables used for the script
if ! command -v pwgen &> /dev/null; then
echo "You must have pwgen installed on your machine to run this script."
exit 1
fi
CMG_COMMAND=docker
DKR_IMAGE="gvenzl/oracle-xe"
DKR_HOST_PORT=$1
DKR_CNT_NAME=$2
DKR_DATA_PATH=dbcxe-$DKR_CNT_NAME-dvol
DKR_ORA_USER_APP=DAAPPUSER
DKR_ORA_PW=$(pwgen -1 16 | tr -d '\n')
DKR_ORA_PW_APP=$(pwgen -1 16 | tr -d '\n')
if [ -z "$DKR_HOST_PORT" ]; then
echo "You must provide docker host port"
exit 1
fi
if [ -z "$DKR_CNT_NAME" ]; then
echo "You must provide dockercontainer name"
exit 1
fi
echo "Docker Image ............................ :'$DKR_IMAGE'"
echo "Database (SYS AND SYSTEM) User Password . :'$DKR_ORA_PW'"
echo "Database Application User ............... :'$DKR_ORA_USER_APP'"
echo "Database Application User Password ...... :'$DKR_ORA_PW_APP'"
echo "Docker Volume Name ...................... :'$DKR_DATA_PATH'"
echo "Docker Host Port ........................ :'$DKR_HOST_PORT'"
echo "Docker Container Name ................... :'$DKR_CNT_NAME'"
$CMG_COMMAND run --name $DKR_CNT_NAME \
-p $DKR_HOST_PORT:1521 \
-e "ORACLE_PASSWORD=$DKR_ORA_PW" \
-e "APP_USER=$DKR_ORA_USER_APP" \
-e "APP_USER_PASSWORD=$DKR_ORA_PW_APP" \
-v $DKR_DATA_PATH:/opt/oracle/oradata \
-d $DKR_IMAGE
echo "Waiting for container '$DKR_CNT_NAME' to start ... "
sleep 10
echo "Docker Container '$DKR_CNT_NAME' has been started on port '$DKR_HOST_PORT'"