Introduction
In this blog, we are going to see how to install Oracle Database 19c in Docker and then to install ORDS and APEX.
Introduction about Docker
Docker is a container-based and an open source platform which are used to develop, deploy and manage applications in the virtualized environment called containers.
Each container consists of its own collection of software, libraries, binary files and configuration files, the important terminologies in Docker which are useful for us to understand are Docker Hub, Docker Image, Docker Container and Docker Engine.
Install Docker
After installing all the necessary rpm which are required to install dockers, we can follow the below steps to install ORDS and Apex in dockers, you can also refer this Blog to install docker: https://doyensys.com/blogs/installing-oracle-database-19-3-in-docker/
Create a new sudo user for dockers,only through this user we can access the docker container
Create a new docker network using this command: docker network create newdockernet, this volume can be used later while configuring oracle database.
To list the created network we can use this command: docker network ls
Create a new docker volume using this command: docker volume create newdockervolume
To list the created volume we can use this command: docker volume ls
Login to the oracle container registry to pull the required images.
docker login container-registry.oracle.com
In our case, we are installing oracle database with the version 19.3 so in the end we have provided the version name.
docker pull container-registry.oracle.com/database/enterprise:19.3.0.0
Then set the image name as oracle19c for container-registry.oracle.com/database/enterprise:19.3.0.0
docker image tag container-registry.oracle.com/database/enterprise:19.3.0.0 oracle19c
Then remove the image container registry.oracle.com/database/enterprise:19.3.0.0 from the dockers container
docker rmi container-registry.oracle.com/database/enterprise:19.3.0.0
Now we can spin up the container from the downloaded (repository) oracle19c image by running the following command by specifying the container name, network, volume and the port which we are going to use.
docker run -d –name cats -p 1521:1521 -e ORACLE_PWD=cats -v newdockervolume:/opt/oracle/oradata –network=newdockernet –hostname spartanhost oracle19c
Then set the new password for sys user by using below command
docker exec cats ./setPassword.sh cats
Then we have to pull the ords latest version for docker from oracle container registry using below command.
docker pull container-registry.oracle.com/database/ords:latest
Once the download is completed set the name for container-registry.oracle.com/database/ords image as ords-22.4 by using tag command and then remove the container-registry.oracle.com/database/ords from the docker images.
Then connect to oracle database by docker exec command by specifying container id and then create a new directory called variables under /opt/oracle
As root user create the following directory, /var/lib/docker/volumes/newdockervolume/_data/volume and provide full permission for docker_user to access this directory
Create conn_string.txt file with the following line: echo ‘CONN_STRING=sys/cats@172.18.0.2:1521/ORCLPDB1’>conn_string.txt, under this directory /var/lib/docker/volumes/newdockervolume/_data/volume
Now, we can spin up an ords container by running the following command (I have provided this directory becaues only at this place I have created conn_string.txt which will be used while configuring ords by docker)
docker run –rm –name ords -v /var/lib/docker/volumes/newdockervolume/_data/volume:/opt/oracle/variables –network=newdockernet -p 8181:8181 ords-22.4
We can check the log while configuring ords by using this command,
docker exec -it ords tail -f /tmp/install_container.log
Once an ords configuration is completed we have to stop the firewall
Now, we can login to the Apex workspace.
ip-address:8181/ords/