Using post-install script of Docker Oracle XE images to upgrade to Apex 5.1.2

Marcelo Ochoa
3 min readSep 12, 2017

You can use Oracle Official 11gXE image on Docker with latest Apex available for downloading at Oracle OTN Web Site, now 5.1.2 release, by simple adding three shell scripts.

First you have to build your Oracle 11g base image by running the script downloaded from GitHub and providing the rpm.zip binary installation at OracleDatabase/dockerfiles/11.2.0.2 directory, here a sample directory content structure:

OracleDatabase/dockerfiles/11.2.0.2 directory contents

next at the parent directory run this command:

./buildDockerImage.sh -v 11.2.0.2 -x

as a result of the docker build command you will get a fresh local image of 11gXE ready to use:

# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
oracle/database 11.2.0.2-xe b35223c35d5c 3 minutes ago 1.13GB

latest Oracle scripts include a hook to provide extra functionality as post installation task, here an example of custom scripts, so if we start a container as:

#!/bin/bash
docker run — shm-size=1g — name apex — hostname apex \
-p 1521:1521 -p 8080:8080 \
-v $PWD/apex-as-postscripts:/u01/app/oracle/scripts/setup \
oracle/database:11.2.0.2-xe

Note that unlike the README.md file the mount point inside XE build image script is /u01/app/oracle/scripts/setup, not /opt/oracle/scripts/setup.

The content of directory apex-as-postscripts is:

content of directory apex-as-postscripts

You can download these scripts at my GitHub repo, but before starting your docker container put inside the directory the Apex distribution file apex_5.1.2_en.zip. For newer releases simple put a new zip and edit 00-unzip-apex.sh script with a proper file name.

Concluding with first time execution of the container output console will look like

now Apex is ready to use, try http://localhost:8080/apex/apex_admin and you will get login screen (use admin and sys/system password generated by Docker install script)

first login Apex admin screen

next screen will ask you for changing admin password

password change for admin user

And that's all you have an instance of latest Oracle Apex running as Docker container.

Remember that we started this image with ephemeral storage for the RDBMS, your Oracle instance will preserve any database change between stop/start cycle, but if you remove the image all changes will be discharged. To avoid that, simple map the RDBMS data-files to an external directory or docker volume, for example:

#!/bin/bash
docker run — shm-size=1g — name apex — hostname apex \
-p 1521:1521 -p 8080:8080 \
-v /home/data/db/apex:/u01/app/oracle/oradata \
-v $PWD/apex-as-postscripts:/u01/app/oracle/scripts/setup \
oracle/database:11.2.0.2-xe

--

--