From 46fca73bd04d79500386f2cb151e78d3ea79851f Mon Sep 17 00:00:00 2001 From: Javier Peletier Date: Tue, 11 Apr 2017 16:48:48 +0200 Subject: [PATCH 01/10] prepare image for mounting a volume in /u0/app/oracle --- Dockerfile | 11 ++++-- assets/startup.sh | 29 --------------- setup-docker.sh | 11 ++++++ assets/setup.sh => setup.sh | 22 ++++++------ startup.sh | 71 +++++++++++++++++++++++++++++++++++++ 5 files changed, 100 insertions(+), 44 deletions(-) delete mode 100644 assets/startup.sh create mode 100755 setup-docker.sh rename assets/setup.sh => setup.sh (73%) create mode 100644 startup.sh diff --git a/Dockerfile b/Dockerfile index d9d88f9..294076e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,17 @@ FROM ubuntu:16.04 -MAINTAINER Wei-Ming Wu +MAINTAINER Javier Peletier ADD assets /assets -RUN /assets/setup.sh +ADD /setup.sh / +RUN /setup.sh +ADD /setup-docker.sh / +ADD /startup.sh /usr/sbin/startup.sh +RUN /setup-docker.sh + EXPOSE 22 EXPOSE 1521 EXPOSE 8080 -CMD /usr/sbin/startup.sh && /usr/sbin/sshd -D +ENTRYPOINT ["/usr/sbin/startup.sh"] diff --git a/assets/startup.sh b/assets/startup.sh deleted file mode 100644 index fcf527f..0000000 --- a/assets/startup.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -LISTENER_ORA=/u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora -TNSNAMES_ORA=/u01/app/oracle/product/11.2.0/xe/network/admin/tnsnames.ora - -cp "${LISTENER_ORA}.tmpl" "$LISTENER_ORA" && -sed -i "s/%hostname%/$HOSTNAME/g" "${LISTENER_ORA}" && -sed -i "s/%port%/1521/g" "${LISTENER_ORA}" && -cp "${TNSNAMES_ORA}.tmpl" "$TNSNAMES_ORA" && -sed -i "s/%hostname%/$HOSTNAME/g" "${TNSNAMES_ORA}" && -sed -i "s/%port%/1521/g" "${TNSNAMES_ORA}" && - -service oracle-xe start - -export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe -export PATH=$ORACLE_HOME/bin:$PATH -export ORACLE_SID=XE - -if [ "$ORACLE_ALLOW_REMOTE" = true ]; then - echo "alter system disable restricted session;" | sqlplus -s SYSTEM/oracle -fi - -for f in /docker-entrypoint-initdb.d/*; do - case "$f" in - *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; echo "exit" | /u01/app/oracle/product/11.2.0/xe/bin/sqlplus "SYS/oracle" AS SYSDBA @"$f"; echo ;; - *) echo "$0: ignoring $f" ;; - esac - echo -done diff --git a/setup-docker.sh b/setup-docker.sh new file mode 100755 index 0000000..2025e29 --- /dev/null +++ b/setup-docker.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +mv /u01/app/oracle/product /u01/app/oracle-product +mv /u01/app/oracle-product/11.2.0/xe/dbs /u01/app/default-dbs +mv /u01/app/oracle/admin /u01/app/default-admin +mv /u01/app/oracle/oradata /u01/app/default-oradata +mv /u01/app/oracle/fast_recovery_area /u01/app/default-fast_recovery_area + +# Install startup script for container + +chmod +x /usr/sbin/startup.sh diff --git a/assets/setup.sh b/setup.sh similarity index 73% rename from assets/setup.sh rename to setup.sh index e7c5aab..9df396b 100755 --- a/assets/setup.sh +++ b/setup.sh @@ -5,14 +5,16 @@ export DEBIAN_FRONTEND=noninteractive cat /assets/oracle-xe_11.2.0-1.0_amd64.deba* > /assets/oracle-xe_11.2.0-1.0_amd64.deb +apt-get update + # Install OpenSSH -apt-get update && -apt-get install -y openssh-server && -mkdir /var/run/sshd && -echo 'root:admin' | chpasswd && -sed -i 's/^PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config && -sed -i 's/session\s*required\s*pam_loginuid.so/session optional pam_loginuid.so/g' /etc/pam.d/sshd && -echo 'export VISIBLE=now' >> /etc/profile && + +#apt-get install -y openssh-server && +#mkdir /var/run/sshd && +#echo 'root:admin' | chpasswd && +#sed -i 's/^PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config && +#sed -i 's/session\s*required\s*pam_loginuid.so/session optional pam_loginuid.so/g' /etc/pam.d/sshd && +#echo 'export VISIBLE=now' >> /etc/profile && # Prepare to install Oracle apt-get install -y libaio1 net-tools bc && @@ -36,13 +38,9 @@ printf 8080\\n1521\\noracle\\noracle\\ny\\n | /etc/init.d/oracle-xe configure && echo 'export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe' >> /etc/bash.bashrc && echo 'export PATH=$ORACLE_HOME/bin:$PATH' >> /etc/bash.bashrc && echo 'export ORACLE_SID=XE' >> /etc/bash.bashrc && - -# Install startup script for container -mv /assets/startup.sh /usr/sbin/startup.sh && -chmod +x /usr/sbin/startup.sh && - # Remove installation files rm -r /assets/ + exit $? diff --git a/startup.sh b/startup.sh new file mode 100644 index 0000000..2062aa5 --- /dev/null +++ b/startup.sh @@ -0,0 +1,71 @@ +#!/bin/bash +LISTENER_ORA=/u01/app/oracle-product/11.2.0/xe/network/admin/listener.ora +TNSNAMES_ORA=/u01/app/oracle-product/11.2.0/xe/network/admin/tnsnames.ora + +cp "${LISTENER_ORA}.tmpl" "$LISTENER_ORA" && +sed -i "s/%hostname%/$HOSTNAME/g" "${LISTENER_ORA}" && +sed -i "s/%port%/1521/g" "${LISTENER_ORA}" && +cp "${TNSNAMES_ORA}.tmpl" "$TNSNAMES_ORA" && +sed -i "s/%hostname%/$HOSTNAME/g" "${TNSNAMES_ORA}" && +sed -i "s/%port%/1521/g" "${TNSNAMES_ORA}" && + + +rm -rf /u01/app/oracle/product + +ln -s /u01/app/oracle-product /u01/app/oracle/product #Mount database installation to the Expanded VOLUME of container + +if [ ! -d /u01/app/oracle/dbs ] ; then + echo "using default configuration" + cp -R /u01/app/default-dbs /u01/app/oracle/dbs +fi + +if [ ! -d /u01/app/oracle/oradata ] ; then + echo "using default data directory" + cp -R /u01/app/default-oradata /u01/app/oracle/oradata +fi + +if [ ! -d /u01/app/oracle/admin ] ; then + echo "using default admin directory" + cp -R /u01/app/default-admin /u01/app/oracle/admin +fi + +if [ ! -d /u01/app/oracle/fast_recovery_area ] ; then + echo "using default fast_recovery_area directory" + cp -R /u01/app/default-fast_recovery_area /u01/app/oracle/fast_recovery_area +fi + +ln -s /u01/app/oracle/dbs /u01/app/oracle-product/11.2.0/xe/dbs #Link db configuration to the installation path form extended volume with DB data + +chown -R oracle:dba /u01/app/oracle + + +service oracle-xe start + +export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe +export PATH=$ORACLE_HOME/bin:$PATH +export ORACLE_SID=XE + +if [ "$ORACLE_ALLOW_REMOTE" = true ]; then + echo "alter system disable restricted session;" | sqlplus -s SYSTEM/oracle +fi + +echo "Running startup scripts ..." + +for f in /docker-entrypoint-initdb.d/*; do + case "$f" in + *.sh) echo "$0: running $f"; . "$f" ;; + *.sql) echo "$0: running $f"; echo "exit" | /u01/app/oracle/product/11.2.0/xe/bin/sqlplus "SYS/oracle" AS SYSDBA @"$f"; echo ;; + *) echo "$0: ignoring $f" ;; + esac + echo +done + + +echo -e "\n\n Bring it on!! \n\n" + +tail -fn 0 /u01/app/oracle/diag/rdbms/xe/XE/trace/alert_XE.log + +echo -e '\n\nShutting down...\n' +service oracle-xe stop + +echo -e "\nbye" From 04f654cc3f331dc9232ec5582f3514296df4126f Mon Sep 17 00:00:00 2001 From: Javier Peletier Date: Tue, 11 Apr 2017 19:02:06 +0200 Subject: [PATCH 02/10] Optimized image size --- Dockerfile | 3 +-- setup-docker.sh | 11 ----------- setup.sh | 11 +++++++++++ startup.sh | 23 ++++++++++++++++------- 4 files changed, 28 insertions(+), 20 deletions(-) delete mode 100755 setup-docker.sh mode change 100644 => 100755 startup.sh diff --git a/Dockerfile b/Dockerfile index 294076e..2847365 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,9 +5,8 @@ MAINTAINER Javier Peletier ADD assets /assets ADD /setup.sh / RUN /setup.sh -ADD /setup-docker.sh / ADD /startup.sh /usr/sbin/startup.sh -RUN /setup-docker.sh + EXPOSE 22 diff --git a/setup-docker.sh b/setup-docker.sh deleted file mode 100755 index 2025e29..0000000 --- a/setup-docker.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -mv /u01/app/oracle/product /u01/app/oracle-product -mv /u01/app/oracle-product/11.2.0/xe/dbs /u01/app/default-dbs -mv /u01/app/oracle/admin /u01/app/default-admin -mv /u01/app/oracle/oradata /u01/app/default-oradata -mv /u01/app/oracle/fast_recovery_area /u01/app/default-fast_recovery_area - -# Install startup script for container - -chmod +x /usr/sbin/startup.sh diff --git a/setup.sh b/setup.sh index 9df396b..46cbeba 100755 --- a/setup.sh +++ b/setup.sh @@ -41,6 +41,17 @@ echo 'export ORACLE_SID=XE' >> /etc/bash.bashrc && # Remove installation files rm -r /assets/ +mv /u01/app/oracle/product /u01/app/oracle-product +pushd /u01/app/oracle-product/11.2.0/xe/ +tar zcvf /u01/app/default-dbs.tar.gz dbs +rm -rf dbs/ +popd + +tar zcvf /u01/app/default-admin.tar.gz /u01/app/oracle/admin && rm -rf /u01/app/oracle/admin +tar zcvf /u01/app/default-oradata.tar.gz /u01/app/oracle/oradata && rm -rf /u01/app/oracle/oradata +tar zcvf /u01/app/default-fast_recovery_area.tar.gz /u01/app/oracle/fast_recovery_area && rm -rf /u01/app/oracle/fast_recovery_area + +# Install startup script for container exit $? diff --git a/startup.sh b/startup.sh old mode 100644 new mode 100755 index 2062aa5..8eed4bb --- a/startup.sh +++ b/startup.sh @@ -1,4 +1,14 @@ #!/bin/bash + +echo "" +echo "Oracle XE 11g CI/Development image" +echo "By Epic Labs, 2017 - http://www.epiclabs.io" +echo "" +echo "https://github.com/epiclabs-io/docker-oracle-xe-11g" +echo "forked from wnameless/docker-oracle-xe-11g" +echo "" +echo "" + LISTENER_ORA=/u01/app/oracle-product/11.2.0/xe/network/admin/listener.ora TNSNAMES_ORA=/u01/app/oracle-product/11.2.0/xe/network/admin/tnsnames.ora @@ -16,29 +26,28 @@ ln -s /u01/app/oracle-product /u01/app/oracle/product #Mount database install if [ ! -d /u01/app/oracle/dbs ] ; then echo "using default configuration" - cp -R /u01/app/default-dbs /u01/app/oracle/dbs + tar xf /u01/app/default-dbs.tar.gz -C /u01/app/oracle/ fi if [ ! -d /u01/app/oracle/oradata ] ; then echo "using default data directory" - cp -R /u01/app/default-oradata /u01/app/oracle/oradata + tar xf /u01/app/default-oradata.tar.gz fi if [ ! -d /u01/app/oracle/admin ] ; then echo "using default admin directory" - cp -R /u01/app/default-admin /u01/app/oracle/admin + tar xf /u01/app/default-admin.tar.gz fi if [ ! -d /u01/app/oracle/fast_recovery_area ] ; then echo "using default fast_recovery_area directory" - cp -R /u01/app/default-fast_recovery_area /u01/app/oracle/fast_recovery_area + tar xf /u01/app/default-fast_recovery_area.tar.gz fi ln -s /u01/app/oracle/dbs /u01/app/oracle-product/11.2.0/xe/dbs #Link db configuration to the installation path form extended volume with DB data chown -R oracle:dba /u01/app/oracle - service oracle-xe start export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe @@ -65,7 +74,7 @@ echo -e "\n\n Bring it on!! \n\n" tail -fn 0 /u01/app/oracle/diag/rdbms/xe/XE/trace/alert_XE.log -echo -e '\n\nShutting down...\n' +echo -e '\n\nShutting down...\n\n' service oracle-xe stop -echo -e "\nbye" +echo -e "\nbye\n" From e3ee7855810772df6ff8e1925546b8221e0cf3af Mon Sep 17 00:00:00 2001 From: Javier Peletier Date: Wed, 12 Apr 2017 00:22:38 +0200 Subject: [PATCH 03/10] update docs --- README.md | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 86968de..4ff7b48 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,39 @@ docker-oracle-xe-11g ============================ +Oracle Express Edition 11g Release 2 on Ubuntu 16.04 LTS. Fork by epiclabs -Oracle Express Edition 11g Release 2 on Ubuntu 16.04 LTS +Credit to all the base work and contributors of wnameless/docker-oracle-xe-11g !! -This **Dockerfile** is a [trusted build](https://registry.hub.docker.com/u/wnameless/oracle-xe-11g/) of [Docker Registry](https://registry.hub.docker.com/). +## Main features of this fork: + +* Volume support. Tweaks the configuration so you only have to mount an external empty directory to kick off your database. +* Removed SSH +* Graceful shutdown ### Installation(with Ubuntu 16.04) -``` -docker pull wnameless/oracle-xe-11g -``` -### Installation(with older Ubuntu 14.04.4) -``` -docker pull wnameless/oracle-xe-11g:14.04.4 +```bash +$ docker pull epiclabs/docker-oracle-xe-11g ``` -Run with 22 and 1521 ports opened: -``` -docker run -d -p 49160:22 -p 49161:1521 wnameless/oracle-xe-11g +Run with port 1521 opened: +```bash +$ docker run -d -p 1521:1521 epiclabs/docker-oracle-xe-11g ``` -Run this, if you want the database to be connected remotely: +Volume support: + +```bash +$ docker run -d -v /var/yourdata:/u01/app/oracle -p 1521:1521 epiclabs/docker-oracle-xe-11g ``` -docker run -d -p 49160:22 -p 49161:1521 -e ORACLE_ALLOW_REMOTE=true wnameless/oracle-xe-11g + +`/var/yourdata` is an empty directory which will be initialized as soon as the image runs for the first time. If the directory already contains data produced by a previous instance of this image, then the data is preserved. With this, the container can be thrown away every time. + + +Run like this, if you want the database to be connected remotely: + +```bash +$ docker run -d -p 49161:1521 -e ORACLE_ALLOW_REMOTE=true epiclabs/docker-oracle-xe-11g ``` Connect database with following setting: @@ -39,16 +50,10 @@ Password for SYS & SYSTEM oracle ``` -Login by SSH -``` -ssh root@localhost -p 49160 -password: admin -``` - Support custom DB Initialization ``` # Dockerfile -FROM wnameless/oracle-xe-11g +FROM epiclabs/oracle-xe-11g ADD init.sql /docker-entrypoint-initdb.d/ ``` From e8e04938519fcdaa371e098a008ef5bb6beea38e Mon Sep 17 00:00:00 2001 From: Javier Peletier Date: Fri, 19 May 2017 12:24:54 +0200 Subject: [PATCH 04/10] Added SYSTEM password customization --- Dockerfile | 1 - setup.sh | 9 --------- startup.sh | 31 +++++++++++++++++++++++++++++-- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2847365..4db3b36 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,6 @@ ADD /startup.sh /usr/sbin/startup.sh -EXPOSE 22 EXPOSE 1521 EXPOSE 8080 diff --git a/setup.sh b/setup.sh index 46cbeba..ea3eb11 100755 --- a/setup.sh +++ b/setup.sh @@ -7,15 +7,6 @@ cat /assets/oracle-xe_11.2.0-1.0_amd64.deba* > /assets/oracle-xe_11.2.0-1.0_amd6 apt-get update -# Install OpenSSH - -#apt-get install -y openssh-server && -#mkdir /var/run/sshd && -#echo 'root:admin' | chpasswd && -#sed -i 's/^PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config && -#sed -i 's/session\s*required\s*pam_loginuid.so/session optional pam_loginuid.so/g' /etc/pam.d/sshd && -#echo 'export VISIBLE=now' >> /etc/profile && - # Prepare to install Oracle apt-get install -y libaio1 net-tools bc && ln -s /usr/bin/awk /bin/awk && diff --git a/startup.sh b/startup.sh index 8eed4bb..2090d2e 100755 --- a/startup.sh +++ b/startup.sh @@ -9,6 +9,8 @@ echo "forked from wnameless/docker-oracle-xe-11g" echo "" echo "" + + LISTENER_ORA=/u01/app/oracle-product/11.2.0/xe/network/admin/listener.ora TNSNAMES_ORA=/u01/app/oracle-product/11.2.0/xe/network/admin/tnsnames.ora @@ -54,8 +56,33 @@ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe export PATH=$ORACLE_HOME/bin:$PATH export ORACLE_SID=XE +if [ -z "$ORACLE_PASSWORD" ] ; then + export ORACLE_PASSWORD="oracle"; +else + if [ ! -e "/custompwd.id" ] ; then + echo "Setting SYS password... " + if ! echo "ALTER USER SYS IDENTIFIED BY \"$ORACLE_PASSWORD\";" | sqlplus -s SYSTEM/oracle ; then + echo "Error setting SYS password." + exit 1; + fi + + echo "Setting SYSTEM password... " + + if ! echo "ALTER USER SYSTEM IDENTIFIED BY \"$ORACLE_PASSWORD\";" | sqlplus -s SYSTEM/oracle ; then + echo "Error setting SYSTEM password." + exit 1; + fi + + touch /custompwd.id + fi + +fi + + + + if [ "$ORACLE_ALLOW_REMOTE" = true ]; then - echo "alter system disable restricted session;" | sqlplus -s SYSTEM/oracle + echo "alter system disable restricted session;" | sqlplus -s "SYSTEM/$ORACLE_PASSWORD" fi echo "Running startup scripts ..." @@ -63,7 +90,7 @@ echo "Running startup scripts ..." for f in /docker-entrypoint-initdb.d/*; do case "$f" in *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; echo "exit" | /u01/app/oracle/product/11.2.0/xe/bin/sqlplus "SYS/oracle" AS SYSDBA @"$f"; echo ;; + *.sql) echo "$0: running $f"; echo "exit" | /u01/app/oracle/product/11.2.0/xe/bin/sqlplus "SYS/$ORACLE_PASSWORD" AS SYSDBA @"$f"; echo ;; *) echo "$0: ignoring $f" ;; esac echo From 5d28d3ccaf42ffcc2dfb6b3ba3d7374ab1007a9a Mon Sep 17 00:00:00 2001 From: Javier Peletier Date: Fri, 19 May 2017 13:21:53 +0200 Subject: [PATCH 05/10] Moved custom password flag to persistent dir --- startup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/startup.sh b/startup.sh index 2090d2e..a590f25 100755 --- a/startup.sh +++ b/startup.sh @@ -59,7 +59,7 @@ export ORACLE_SID=XE if [ -z "$ORACLE_PASSWORD" ] ; then export ORACLE_PASSWORD="oracle"; else - if [ ! -e "/custompwd.id" ] ; then + if [ ! -e "/u01/app/oracle/custompwd.id" ] ; then echo "Setting SYS password... " if ! echo "ALTER USER SYS IDENTIFIED BY \"$ORACLE_PASSWORD\";" | sqlplus -s SYSTEM/oracle ; then echo "Error setting SYS password." @@ -73,7 +73,7 @@ else exit 1; fi - touch /custompwd.id + touch /u01/app/oracle/custompwd.id fi fi From 79af564abc97e21739eea4bfddcb39c56958ae78 Mon Sep 17 00:00:00 2001 From: Javier Peletier Date: Fri, 19 May 2017 14:12:35 +0200 Subject: [PATCH 06/10] Added password policy relax optional flag and updated docs --- README.md | 26 +++++++++++++++++++++++++- startup.sh | 38 ++++++++++++++++++++++++++++++-------- 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 4ff7b48..9b4f974 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ username: system password: oracle ``` -Password for SYS & SYSTEM +Default password for SYS & SYSTEM ``` oracle ``` @@ -57,3 +57,27 @@ FROM epiclabs/oracle-xe-11g ADD init.sql /docker-entrypoint-initdb.d/ ``` + +### Environment variables + +* `ORACLE_PASSWORD` : Changes SYS and SYSTEM password to this value +* `RELAX_SECURITY` : If set to 1, a relaxed password policy profile will be put in place with this parameters for `SYS` and `SYSTEM` : + +``` +CREATE PROFILE NOEXPIRY LIMIT + COMPOSITE_LIMIT UNLIMITED + PASSWORD_LIFE_TIME UNLIMITED + PASSWORD_REUSE_TIME UNLIMITED + PASSWORD_REUSE_MAX UNLIMITED + PASSWORD_VERIFY_FUNCTION NULL + PASSWORD_LOCK_TIME UNLIMITED + PASSWORD_GRACE_TIME UNLIMITED + FAILED_LOGIN_ATTEMPTS UNLIMITED; +``` + +Example: + +```bash +$ docker run -d -p 1521:1521 -e ORACLE_ALLOW_REMOTE=true -e ORACLE_PASSWORD=testpassword -e RELAX_SECURITY=1 epiclabs/docker-oracle-xe-11g +``` + diff --git a/startup.sh b/startup.sh index a590f25..4a77bfd 100755 --- a/startup.sh +++ b/startup.sh @@ -56,10 +56,34 @@ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe export PATH=$ORACLE_HOME/bin:$PATH export ORACLE_SID=XE -if [ -z "$ORACLE_PASSWORD" ] ; then - export ORACLE_PASSWORD="oracle"; -else - if [ ! -e "/u01/app/oracle/custompwd.id" ] ; then + +if [ ! -e "/u01/app/oracle/initialized.id" ] ; then + + echo "Performing initial database setup ..." + + if [ ! -z "$RELAX_SECURITY" ] ; then + echo "WARNING: Relaxing profile security with no password reuse limits, etc. Use with caution ..." + echo "CREATE PROFILE NOEXPIRY LIMIT + COMPOSITE_LIMIT UNLIMITED + PASSWORD_LIFE_TIME UNLIMITED + PASSWORD_REUSE_TIME UNLIMITED + PASSWORD_REUSE_MAX UNLIMITED + PASSWORD_VERIFY_FUNCTION NULL + PASSWORD_LOCK_TIME UNLIMITED + PASSWORD_GRACE_TIME UNLIMITED + FAILED_LOGIN_ATTEMPTS UNLIMITED;" | sqlplus -s SYSTEM/oracle + + echo "ALTER USER SYSTEM PROFILE NOEXPIRY;" | sqlplus -s SYSTEM/oracle + echo "ALTER USER SYS PROFILE NOEXPIRY;" | sqlplus -s SYSTEM/oracle + echo "Security relaxed." + + fi + + if [ -z "$ORACLE_PASSWORD" ] ; then + echo "Warning: using default password!!. Set ORACLE_PASSWORD environment variable to change it" + export ORACLE_PASSWORD="oracle"; + else + echo "Setting SYS password... " if ! echo "ALTER USER SYS IDENTIFIED BY \"$ORACLE_PASSWORD\";" | sqlplus -s SYSTEM/oracle ; then echo "Error setting SYS password." @@ -72,15 +96,13 @@ else echo "Error setting SYSTEM password." exit 1; fi - - touch /u01/app/oracle/custompwd.id fi - + + touch "/u01/app/oracle/initialized.id" fi - if [ "$ORACLE_ALLOW_REMOTE" = true ]; then echo "alter system disable restricted session;" | sqlplus -s "SYSTEM/$ORACLE_PASSWORD" fi From 4aa4bae296c62a8a9649e2cc55a4271e630a70ab Mon Sep 17 00:00:00 2001 From: Victor Corte Date: Thu, 14 May 2020 16:31:14 -0300 Subject: [PATCH 07/10] Fix ORA-02199: missing DATAFILE/TEMPFILE when creating a new tablespace (#1) * setting db_create_file parameter * fix sqlplus command * mkdir if not exists --- setup.sh | 2 +- startup.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index ea3eb11..86a2d76 100755 --- a/setup.sh +++ b/setup.sh @@ -10,7 +10,7 @@ apt-get update # Prepare to install Oracle apt-get install -y libaio1 net-tools bc && ln -s /usr/bin/awk /bin/awk && -mkdir /var/lock/subsys && +mkdir -p /var/lock/subsys && mv /assets/chkconfig /sbin/chkconfig && chmod 755 /sbin/chkconfig && diff --git a/startup.sh b/startup.sh index 4a77bfd..7f180b5 100755 --- a/startup.sh +++ b/startup.sh @@ -55,6 +55,7 @@ service oracle-xe start export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe export PATH=$ORACLE_HOME/bin:$PATH export ORACLE_SID=XE +export ORACLE_DATA=/u01/app/oracle/oradata/$ORACLE_SID if [ ! -e "/u01/app/oracle/initialized.id" ] ; then @@ -79,6 +80,12 @@ if [ ! -e "/u01/app/oracle/initialized.id" ] ; then fi + echo "Setting db_create_file_dest param..." + if ! echo "ALTER SYSTEM SET db_create_file_dest = '$ORACLE_DATA';" | sqlplus -s SYSTEM/oracle; then + echo "error setting db_create_file_dest param" + exit 1 + fi + if [ -z "$ORACLE_PASSWORD" ] ; then echo "Warning: using default password!!. Set ORACLE_PASSWORD environment variable to change it" export ORACLE_PASSWORD="oracle"; From 14bbd91c7385cdf006fd45186dc06cdfe029dc7e Mon Sep 17 00:00:00 2001 From: Rob Date: Mon, 6 Nov 2023 13:14:07 +0100 Subject: [PATCH 08/10] harmonizing with wnameless --- Dockerfile | 9 ++------- setup.sh => assets/setup.sh | 0 startup.sh => assets/startup.sh | 0 3 files changed, 2 insertions(+), 7 deletions(-) rename setup.sh => assets/setup.sh (100%) rename startup.sh => assets/startup.sh (100%) diff --git a/Dockerfile b/Dockerfile index 4db3b36..59259f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,8 @@ FROM ubuntu:16.04 -MAINTAINER Javier Peletier - ADD assets /assets -ADD /setup.sh / -RUN /setup.sh -ADD /startup.sh /usr/sbin/startup.sh - - +RUN assets/setup.sh +RUN mv /assets/startup.sh /usr/sbin/startup.sh EXPOSE 1521 EXPOSE 8080 diff --git a/setup.sh b/assets/setup.sh similarity index 100% rename from setup.sh rename to assets/setup.sh diff --git a/startup.sh b/assets/startup.sh similarity index 100% rename from startup.sh rename to assets/startup.sh From 955b50363238339d976802b1f7105b44c81fd9ab Mon Sep 17 00:00:00 2001 From: Rob Date: Mon, 6 Nov 2023 13:57:37 +0100 Subject: [PATCH 09/10] Dockerfile order + README cleanup --- Dockerfile | 2 +- README.md | 40 ++++++++++------------------------------ 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index 95583bf..d64c096 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ FROM ubuntu:18.04 COPY assets /assets -RUN /assets/setup.sh RUN mv /assets/startup.sh /usr/sbin/startup.sh +RUN /assets/setup.sh EXPOSE 1521 EXPOSE 8080 diff --git a/README.md b/README.md index fe1d6c6..1e7cc84 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,15 @@ docker-oracle-xe-11g ============================ -Oracle Express Edition 11g Release 2 on Ubuntu 16.04 LTS. Fork by epiclabs Oracle Express Edition 11g Release 2 on Ubuntu 18.04 LTS -This **Dockerfile** is a [trusted build](https://registry.hub.docker.com/u/wnameless/oracle-xe-11g/) of [Docker Registry](https://registry.hub.docker.com/). -Since 2019-Feb-13(the Valentine's day eve) this docker image has been removed by DockerHub due to the Docker DMCA Takedown Notice from the Copyright owner which is the Oracle. - -Happy Valentine's day! - -```diff -+ The new DockerHub [wnameless/oracle-xe-11g-r2] has been released, because -+ the old [wnameless/oracle-xe-11g] is banned by DockerHub and I cannot restore it. -+ Thanks for the help from the staff in Oracle with my DMCA Takedown issue, however this problem -+ is totally ignored by the DockerHub and I barely can't do anything but to open a new repo. -+ Sep 29 2019 -``` - -## Installation(Local) +## Installation ``` -git clone https://github.com/wnameless/docker-oracle-xe-11g.git +git clone https://github.com/interob/docker-oracle-xe-11g.git cd docker-oracle-xe-11g -docker build -t wnameless/oracle-xe-11g . -``` - -## Installation(DockerHub) -``` -docker pull wnameless/oracle-xe-11g-r2 +docker build -t interob/oracle-xe-11g . ``` -SSH server has been removed since 18.04, please use "docker exec" Volume support: @@ -48,17 +28,17 @@ $ docker run -d -p 49161:1521 -e ORACLE_ALLOW_REMOTE=true epiclabs/docker-oracle For performance concern, you may want to disable the disk asynch IO: ``` -docker run -d -p 49161:1521 -e ORACLE_DISABLE_ASYNCH_IO=true wnameless/oracle-xe-11g-r2 +docker run -d -p 49161:1521 -e ORACLE_DISABLE_ASYNCH_IO=true interob/oracle-xe-11g-r2 ``` Enable XDB user with default password: xdb, run this: ``` -docker run -d -p 49161:1521 -e ORACLE_ENABLE_XDB=true wnameless/oracle-xe-11g-r2 +docker run -d -p 49161:1521 -e ORACLE_ENABLE_XDB=true interob/oracle-xe-11g-r2 ``` For APEX user: ``` -docker run -d -p 49161:1521 -p 8080:8080 wnameless/oracle-xe-11g-r2 +docker run -d -p 49161:1521 -p 8080:8080 interob/oracle-xe-11g-r2 ``` ``` @@ -67,9 +47,9 @@ username: ADMIN password: admin ``` -For latest APEX(18.1) user, please pull wnameless/oracle-xe-11g-r2:18.04-apex first: +For latest APEX(18.1) user, please pull interob/oracle-xe-11g-r2:18.04-apex first: ``` -docker run -d -p 49161:1521 -p 8080:8080 wnameless/oracle-xe-11g-r2:18.04-apex +docker run -d -p 49161:1521 -p 8080:8080 interob/oracle-xe-11g-r2:18.04-apex ``` ``` @@ -96,7 +76,7 @@ oracle Support custom DB Initialization and running shell scripts ``` # Dockerfile -FROM epiclabs/oracle-xe-11g +FROM interob/oracle-xe-11g ADD init.sql /docker-entrypoint-initdb.d/ ADD script.sh /docker-entrypoint-initdb.d/ @@ -123,6 +103,6 @@ CREATE PROFILE NOEXPIRY LIMIT Example: ```bash -$ docker run -d -p 1521:1521 -e ORACLE_ALLOW_REMOTE=true -e ORACLE_PASSWORD=testpassword -e RELAX_SECURITY=1 epiclabs/docker-oracle-xe-11g +$ docker run -d -p 1521:1521 -e ORACLE_ALLOW_REMOTE=true -e ORACLE_PASSWORD=testpassword -e RELAX_SECURITY=1 interob/docker-oracle-xe-11g ``` From 18fa53b56ccc33be3514548b6c86547015c9b630 Mon Sep 17 00:00:00 2001 From: Rob Date: Mon, 6 Nov 2023 14:08:08 +0100 Subject: [PATCH 10/10] remove redundant mv command (see setup.sh) --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d64c096..446ba0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ FROM ubuntu:18.04 COPY assets /assets -RUN mv /assets/startup.sh /usr/sbin/startup.sh RUN /assets/setup.sh EXPOSE 1521