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)|
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.
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.
In another terminal tab, set the
sys password to
Oradoc_db1 and install APEX
In a terminal tab on your laptop run:
The above command will open a
SQL prompt. Run the following scripts:
Now 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.
You should now be able to go to localhost:32713/ords/ on your laptop to run APEX
sqlcl is my alias for SQLcl. More information on how to install SQLcl on MacOS here.