Contents

Want to use APEX 22.1 or 21.2 on Docker? Here’s a handy step-by-step guide to go through the configuration process.

This guide will allow you to use APEX 22.1 or 21.2 on Docker (Oracle-Base updates itsscripts with the latest version of APEX). Keep in mind that I originally wrote these notes for personal use, so treat this blog post as a theoretical example – don’t attempt to use what you find here anywhere near production. I’m not a DBA (Database Administrator).

Basic information

In this approach, we will:

  1. Accept that this creates a PDB1 with the latest version (rather than modify their scripts)
  2. Use PDB1 as a base and spawn more PDBs with specific versions of APEX we wish to use

Assumptions

  1. This article is based on Oracle Linux 8 and Enterprise Edition 21 of the DB
  2. The current OL8_21 repository has been updated to APEX 22.1. We will use the version of APEX that the repository has been updated with

Instructions

Here are the steps you need to follow to set things up. 

1. Install Docker Desktop from here

2. Download Oracle Base Docker Images Repository and unzip to C:\1\dockerfiles-master

3. Choose an Oracle Linux + DB version i.e, Oracle Linux 8 and Enterprise Edition 21

4. Obtain all software described in the readme.md and place it in the C:\1\dockerfiles-master\database\ol8_21\software folder

5. Open the CMD window and type the following 

cd C:\1\dockerfiles-master\database\ol8_21

6. Create a network

docker network create my_network

7. Build image (this will take a couple of minutes)

docker build -t ol8_21:latest .

8. In Docker Desktop, Click Volumes, Create. Im using DB 21 so I will name my Volume OracleDB21Data

9. Create the Container from the image

docker run -dit --name ol8_21_con -p 1521:1521 -p 5500:5500 --shm-size="1G" --network=my_network -v OracleDB21Data:/u02 ol8_21:latest

10. In Docker Desktop, Double click the ol_21_con Container Name and see the Logs. Allow a minimum of 30mins until complete 

An image showing the configuration.

It should look like this when it is finished.

An image showing configuration.

11. When this is complete we can do a connection from the terminal (command below is for SQLcl) that our PDB is running

sql sys/SysPassword1@localhost:1521/cdb1 as sysdba

An image showing the console.

PDBs

Now we’ll create PDBs – one for the SAME version of APEX and one for ANOTHER version of APEX (I’m going for the prior version)

While still logged in, run the following:

CREATE PLUGGABLE DATABASE APEX221PDB FROM PDB1;

ALTER PLUGGABLE DATABASE APEX221PDB OPEN READ WRITE;

ALTER PLUGGABLE DATABASE APEX221PDB SAVE STATE;



CREATE PLUGGABLE DATABASE APEX212PDB FROM PDB1;

ALTER PLUGGABLE DATABASE APEX212PDB OPEN READ WRITE;

ALTER PLUGGABLE DATABASE APEX212PDB SAVE STATE;

Now let’s focus on the APEX221PDB version of APEX

1. Look at the software in the README.md of github.com/oraclebase/dockerfiles/tree/mast.. and add it to C:\1\dockerfiles-master\ords\ol8_ords\software

2. In CMD, navigate to C:\1\dockerfiles-master\ords\ol8_ords

3. Make the build (adjust the numbers to match the version of APEX e.g 221)

docker build -t ol8_ords_221:latest .

4. In Docker Desktop, Click Volumes, Create. I’m using APEX 221, so I will name my Volume OracleORDS221Data

5. Create the container (adjust all the numbers to match the version of APEX e.g 221)

docker run -dit --name ol8_ords_con_221 -p 8221:8080 -p 9221:8443 -e DB_HOSTNAME=ol8_21_con -e DB_SERVICE=APEX221PDB -e PDB_NAME=APEX221PDB --network=my_network -v OracleORDS221Data:/u01/config/instance1 ol8_ords_221:latest

6. Click the container name in Docker Desktop to check on progress. When complete, it will look like this:

An image showing the configuration.

7. Check out the link at localhost:8221/ords. The INTERNAL password is ApexPassword1

An image showing APEX.

Now, let’s install  ANOTHER version of APEX into the APEX212PDB. Here’s what you need to do:

1. In Windows Explorer, unzip C:\1\dockerfiles-master\ords\ol8_ords\software to folder apex_22.1_en

2. Open CMD or terminal and change folder:

cd C:\1\dockerfiles-master\ords\ol8_ords\software\apex_22.1_en\apex

3. Log on to the PDB and install APEX 21.2 (remember we renamed the zip), this time using SQLPLUS. It doesn’t work with SQLcl

sqlplus sys/SysPassword1@localhost:1521/APEX212PDB as sysdba

4. Run the following

@apxremov.sql

5. Exit out of SQLPLUS

6. Delete or rename the apex_22.1_en folder

7. Download APEX 21.2 from here

8. When downloaded, rename the zip file to apex_22.1_en.zip

9. Move it to C:\1\dockerfiles-master\ords\ol8_ords\software, overwriting the current zip

10. Extract the zip to apex_22.1_en

11. Open CMD or terminal, and change the folder

cd C:\1\dockerfiles-master\ords\ol8_ords\software\apex_22.1_en\apex

12. Log on to the PDB and install APEX 21.2 (remember we renamed the zip), this time using SQLPLUS. It doesn’t work with SQLcl

sqlplus sys/SysPassword1@localhost:1521/APEX212PDB as sysdba

13. Run the following

@apexins.sql SYSAUX SYSAUX TEMP /i/

14. Run the following

@apxchpwd.sql;

ALTER USER APEX_PUBLIC_USER IDENTIFIED BY ApexPassword1 ACCOUNT UNLOCK;

@apex_rest_config.sql; (use password ApexPassword1)

15. In CMD, navigate to the correct folder

cd C:\1\dockerfiles-master\ords\ol8_ords

16. Make the build (adjust the numbers to match the version of APEX e.g, 212)

docker build -t ol8_ords_212:latest .

17. In Docker Desktop, Click Volumes, Create. I’m using APEX 212 so I will name my Volume OracleORDS212Data

18. Create the container (adjust all the 212 numbers to match the version of APEX e.g.,, 212)

docker run -dit --name ol8_ords_con_212 -p 8212:8080 -p 9212:8443 -e DB_HOSTNAME=ol8_21_con -e DB_SERVICE=APEX212PDB -e PDB_NAME=APEX212PDB --network=my_network -v OracleORDS212Data:/u01/config/instance1 ol8_ords_212:latest

19. Click the container name in Docker Desktop to check on progress. When complete, it will look like this

20. Check out the link at localhost:8212/ords. The INTERNAL password is ApexPassword1

Conclusion

And that’s about it. To save memory, it’s probably best to have only one running ORDS Container. I’ll leave you with one final handy command:

select username from all_users where username like 'APEX%' or username like 'ORDS%'

If you have any questions, you can always reach me at mmulvaney@pretius.com. Also, check out my other blog posts regarding Oracle APEX:

  1. Oracle APEX Global Notification messages: An easy way to make them look better
  2. How the Oracle APEX community helps shape the platform’s future
  3. Oracle APEX new features – the low-code platform keeps evolving
  4. Oracle 23c Free Docker, APEX & ORDS – all in one simple guide
  5. Oracle APEX CI/CD: Step-by-step guide aligned to the APEX Application Lifecycle Technical Paper
Share