Skip to content

Commit b7bc3d2

Browse files
committed
Fixed issue with mounted data
1 parent f4d7a46 commit b7bc3d2

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ chmod 755 /sbin/chkconfig &&\
1616

1717
EXPOSE 1521
1818
EXPOSE 8080
19-
VOLUME ["/u01/app/oracle/oradata"]
19+
VOLUME ["/u01/app/oracle"]
2020

2121
ADD entrypoint.sh /
2222
ENTRYPOINT ["/entrypoint.sh"]

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Run with 8080 and 1521 ports opened:
1515

1616
Run with data on host and reuse it:
1717

18-
docker run -d -p 8080:8080 -p 1521:1521 -v /my/oracle/data:/u01/app/oracle/oradata sath89/oracle-xe-11g
18+
docker run -d -p 8080:8080 -p 1521:1521 -v /my/oracle/data:/u01/app/oracle sath89/oracle-xe-11g
1919

2020
Connect database with following setting:
2121

@@ -37,11 +37,12 @@ Connect to Oracle Application Express web management console with following sett
3737
password: oracle
3838

3939
**CHANGELOG**
40-
* Fixed issue with ownership of mounted data folders.
41-
* Fixed issue with Gracefull shutdown of service.
42-
* Reduse size of image from 3.8G to 825Mb.
43-
* Database initialization moved out of the image build phase. Now database initializes at the containeer startup with no database files mounted.
44-
* Added database media reuse support outside of container.
45-
* Added graceful shutdown on containeer stop.
46-
* Removed sshd.
40+
* Fixed issue with reusable mounted data
41+
* Fixed issue with ownership of mounted data folders
42+
* Fixed issue with Gracefull shutdown of service
43+
* Reduse size of image from 3.8G to 825Mb
44+
* Database initialization moved out of the image build phase. Now database initializes at the containeer startup with no database files mounted
45+
* Added database media reuse support outside of container
46+
* Added graceful shutdown on containeer stop
47+
* Removed sshd
4748

entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
# Prevent owner issues on mounted folders
44
chown -R oracle:dba /u01/app/oracle
5+
rm -f /u01/app/oracle/product
6+
ln -s /u01/app/oracle-product /u01/app/oracle/product
57
# Update hostname
68
sed -i -E "s/HOST = [^)]+/HOST = $HOSTNAME/g" /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
9+
sed -i -E "s/PORT = [^)]+/PORT = 1521/g" /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
710
echo "export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe" > /etc/profile.d/oracle-xe.sh
811
echo "export PATH=\$ORACLE_HOME/bin:\$PATH" >> /etc/profile.d/oracle-xe.sh
912
echo "export ORACLE_SID=XE" >> /etc/profile.d/oracle-xe.sh
@@ -14,8 +17,16 @@ case "$1" in
1417
#Check for mounted database files
1518
if [ "$(ls -A /u01/app/oracle/oradata)" ]; then
1619
echo "found files in /u01/app/oracle/oradata Using them instead of initial database"
20+
echo "XE:$ORACLE_HOME:N" >> /etc/oratab
21+
chown oracle:dba /etc/oratab
22+
chown 664 /etc/oratab
23+
printf "ORACLE_DBENABLED=false\nLISTENER_PORT=1521\nHTTP_PORT=8080\nCONFIGURE_RUN=true\n" > /etc/default/oracle-xe
24+
rm -rf /u01/app/oracle-product/11.2.0/xe/dbs
25+
ln -s /u01/app/oracle/dbs /u01/app/oracle-product/11.2.0/xe/dbs
1726
else
1827
echo "Database not initialized. Initializing database."
28+
mv /u01/app/oracle-product/11.2.0/xe/dbs /u01/app/oracle/dbs
29+
ln -s /u01/app/oracle/dbs /u01/app/oracle-product/11.2.0/xe/dbs
1930
printf 8080\\n1521\\noracle\\noracle\\ny\\n | /etc/init.d/oracle-xe configure
2031
echo "Database initialized. Please visit http://#containeer:8080/apex to proceed with configuration"
2132
fi

oracle-install.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ rm -f /oracle-xe_11.2.0-1.0_amd64.deb*
99
mv /init.ora /u01/app/oracle/product/11.2.0/xe/config/scripts
1010
mv /initXETemp.ora /u01/app/oracle/product/11.2.0/xe/config/scripts
1111

12+
mv /u01/app/oracle/product /u01/app/oracle-product
13+
1214
apt-get clean && rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*

0 commit comments

Comments
 (0)