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

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:

Image for post
Image for post
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:

Image for post
Image for post
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

Image for post
Image for post

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)

Image for post
Image for post
first login Apex admin screen

next screen will ask you for changing admin password

Image for post
Image for post
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

Image for post
Image for post

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store