Update: I’ve moved my setup process to Dockerize Oracle and APEX to Github. It will be maintained with the latest steps I’m using it. The repository is docker-oracle-setup.
Last week I needed to test an Oracle 12.2 feature and got hooked on Docker. I wrote an article on how to setup an Oracle DB 12.2 Docker container. This solved my goal to test the 12.2 feature. Roel Hartman then wrote a followup article about how to setup an Oracle database in a Docker container but preserve the data on his laptop. I.e. if the container was deleted or needed to be rebuilt his database data wouldn’t be lost.
Roel’s article inspired me to setup an entire Dockerized Oracle and APEX environment, thus replacing my current local VM infrastructure. I took a lot of notes about the process. The result is this blog post which contains everything I did to create my containers and link them together. To get it all working I used the following articles and all my scripts are a result of a combination of the code found in the links.
- APEX and ORDS up and running in….2 steps! by Joel Kallman
- Dockerize your APEX development environment by Roel Hartman
- Oracle Database 12c now available on Docker by Maria Colgan
- ORDS Docker Setup by Lucas Souza
A few things to keep in mind that will help when reading the rest of this article:
- All my scripts are Linux / MacOS focused. If you use a Windows machine you’ll need to translate
- I specifically made reference to “your laptop” to emphasize what was run “on your machine” vs “in a docker container”
The following key configurations were used for the containers:
Due to licensing restrictions I can’t host/provide these files in Github or elsewhere. As such you’ll need to download them manually. Download the following files and store them in your
- Docker Images: github.com/oracle/docker-images. This will be saved as
- Oracle 12.2 Database: Go to www.oracle.com/technetwork/database/enterprise-edition/downloads and download
- APEX: Go to www.oracle.com/technetwork/developer-tools/apex/downloads and download latest version of APEX. For this blog it was
- ORDS: Go to www.oracle.com/technetwork/developer-tools/rest-data-services/downloads and download latest version of ORDS. For this blog it was
The following script will create a folder structure that looks like:
||To host APEX installation and images for each version|
||APEX 5.1.3 installation files|
||Hold Oracle 12.2 data files|
||ORDS Dockerfile (to build ORDS image)|
# ORDS (done in ORDS section)
This will be a different setup then I previously blogged about in that this docker container will separate the data from the app. I.e. we can remove the container and rebuild it while keeping all the data in place. This allows for us to
In order for the containers to “talk” to each other we need to setup a Docker network and associate all the containers on this network. Containers can reference each other by their respective container names. When referencing another container on the same Docker network the port used is the container’s native port not the mapped port on your laptop.
docker network create oracle_network
The following command will create and run the Oracle Docker container. It’s TNS listener will be accesible via port
32712 on your laptop. The reference to the APEX installation files are necessary only whe installing APEX.
-e TZ will set the appropriate timezine for the OS and the database. A full list of timezones can be found here. If excluded it will default to UTC.
docker run \
In another terminal tab, set the
sys password to
Oradoc_db1 and install APEX
docker exec oracle ./setPassword.sh Oradoc_db1
In a terminal tab on your laptop run:
# Install and configure APEX
The above command will open a
SQL prompt. Run the following scripts:
-- Install APEX
Now exit bash:
# Exit bash
The following assumes that you’ve downloaded ORDS
3.0.12. Referencing the ORDS version so that can create ORDS images for each ORDS release.
The scripts below will first create the ORDS Docker image then create the containers.
# Uses https://github.com/martindsouza/docker-ords Dockerfile
You should now be able to go to localhost:32713/ords/ on your laptop to run APEX
docker stop -t 200 oracle
define new_user = 'martin'