8i | 9i | 10g | 11g | 12c | 13c | 18c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux

Home » Articles » Linux » Here

Docker : Oracle REST Data Services (ORDS) on Docker

This article describes a simple build for running Oracle REST Data Services (ORDS) on Docker.

Related articles.

Assumptions

This article assumes the following.

Build the Image

The Dockerfile and scripts this article is based upon can be found here. The build expects the following file system.

$ tree
.
├── Dockerfile
├── README.md
├── scripts
│   ├── healthcheck.sh
│   ├── server.xml
│   └── start.sh
└── software
    ├── apache-tomcat-8.5.24.tar.gz
    ├── apex_5.1.4_en.zip
    ├── jdk-8u161-linux-x64.tar.gz
    ├── ords.17.4.1.353.06.48.zip
    ├── put_software_here.txt
    └── sqlcl-17.4.0.354.2224-no-jre.zip

2 directories, 11 files
$

You will have to download the software yourself and place it in the "software" directory.

The Dockerfile contains some basic instructions, which will be described further here.

With all the files in place you can build the image using the following command.

$ docker build -t ol7_ords:latest .

The build performs the following actions.

You will notice the build phase doesn't configure ORDS. That is done on the first run of a container.

Run a Container

ORDS is configured each time the container is started. If it is the first time ORDS has been configured on the database, ORDS is installed. If this is a newer version of ORDS than on the database, the ORDS installation on the database is upgraded. If the ORDS versions match, the configuration gracefully completes with no work done. As a result we don't need to worry about testing to see if the configuration has already been completed and we don't have to worry about persistent storage.

The ORDS container must connect to an existing database containing the correct version of APEX. In the following example we use the default values for all the credentials, but amend the database hostname.

$ docker run -dit --name ol7_ords_con \
             -p 8080:8080 -p 8443:8443 \
             -e "DB_HOSTNAME=my-server.localdomain" \
             ol7_ords:latest

If the database were running on another container, as described here, we could connect directly to that container using a Docker network.

$ docker run -dit --name ol7_ords_con \
             -p 8080:8080 -p 8443:8443 \
             --network=my_network \
             -e "DB_HOSTNAME=ol7_122_con" \
             ol7_ords:latest

In reality we would expect to alter the database and ORDS credentials during the run using environment variables, as shown below.

$ docker run -dit --name ol7_ords_con \
             -p 8080:8080 -p 8443:8443 \
             --network=my_network \
             -e "DB_HOSTNAME=ol7_122_con" \
             -e "DB_PORT=1521" \
             -e "DB_SERVICE=pdb2" \
             -e "APEX_PUBLIC_USER_PASSWORD=ApexPassword2" \
             -e "APEX_TABLESPACE=SYSAUX" \
             -e "TEMP_TABLESPACE=TEMP" \
             -e "APEX_LISTENER_PASSWORD=ApexPassword2" \
             -e "APEX_REST_PASSWORD=ApexPassword2" \
             -e "PUBLIC_PASSWORD=ApexPassword2" \
             -e "SYS_PASSWORD=SysPassword2" \
             ol7_ords:latest

start.sh Script

The start.sh script is responsible for configuring ORDS on the first run of the container. It performs the following actions.

healthcheck.sh Script

At the time of writing, the healthcheck.sh script always returns "0" to say successful. This will be revised later.

Managing the Container

Once the container is running you can connect to a bash shell using the following command.

$ docker exec -it ol7_ords_con bash

The container can be stopped and started using the following commands. The "--time" parameter give the application server a chance to shutdown gracefully.

$ docker stop --time=15 ol7_ords_con
$ docker start ol7_ords_con

The following command removes the container and the associated volumes. Persistent storage is not required for the application server, so there is no harm doing this and running the container again.

$ docker rm -vf ol7_ords_con 

For more information see:

Hope this helps. Regards Tim...

Back to the Top.