Saturday, October 20, 2018

How to Create Docker Images For Oracle DB 18.3 APEX 18.1 and ORDS 18.2

Scope:

We would like to containize livesql sandbox.  The purpose is to create docker images for Oracle Database 18.3 , APEX 18.1  ORDS 18.2

Database Part:

  • Go to github and download all the scripts of  Database18.3  from Oracle Github
    • Refer readme doc on the github to understand how dockfile works on DB
    • put them into directory (ie  /u01/build/db18.3 )
  • Download LINUX.X64_180000_db_home.zip  from OTN  and put it the same directory as scripts from github  (ie  /u01/build/db18.3)
  • If your servers are behind proxy, Add below 2 lines into Dockerfile to let new image to access  internet. ( change the proxy name if necessary)
    • HTTP_PROXY=http://yourproxy.com:80 
    • HTTPS_PROXY=http://yourproxy.com:80 
  • cd  /u01/build/db18.3   and  docker build -t oracle/database:18.3.0-ee . 
  • It will build the image for Database 18.3 ( use docker images to check )
  • To create volumes outside docker to hold all datafiles and related config files
    • mkdir -p /u01/build/db18.3/oradata
    • chown -R 54321:54321  /u01/build/db18.3/oradata    (54321 is the UID of oracle user from Docker image)
docker run -itd --name testdb  -p 1528:1521 -p 5500:5500  -e ORACLE_SID=LTEST  -e ORACLE_PDB=ltestpdb  -e ORACLE_PWD=<password>  -v /u01/build/db18.3/oradata:/opt/oracle/oradata   oracle/database:18.3.0-ee
    • it will create a new CDB with name LTEST and a new PDB with name ltestpdb for you
    • We can run this command again and again. It will detect the DB was created , not create a new one
    • use  'docker logs testdb'   to check status
    • use  'docker exec -t testdb   /bin/bash'   to  get into the docker  container to inspect

APEX 18.1 Part:

  • Go to otn 
    • Download apex18.1 zip 
    • upload it to /u01/build/db18.3/oradata/ and unzip it
    • chown  -R 54321:54321 ./apex 
    • use  'docker exec -t livesql_testdb   /bin/bash'  get into the docker  container 
    • cd  /opt/oracle/oradata/apex
    • sqlplus / as sysdba
    • alter session set container=ltestpdb;
    • install APEX inside the docker container
@apexins SYSAUX SYSAUX TEMP /i/
— Run the apex_rest_config command
@apex_rest_config.sql

  • Change and unlock the apex related accounts
  • alter user APEX_180100 identified by <password>;
  • alter user APEX_INSTANCE_ADMIN_USER identified by <password>;
  • alter user APEX_LISTENER identified by <password>;
  • alter user APEX_PUBLIC_USER identified by <password>;
  • alter user APEX_REST_PUBLIC_USER identified by <password>;
  • alter user APEX_180100 account unlock;
  • alter user APEX_INSTANCE_ADMIN_USER account unlock;
  • alter user APEX_LISTENER account unlock;
  • alter user APEX_PUBLIC_USER account unlock;
  • alter user APEX_REST_PUBLIC_USER account unlock;

ORDS 18.2 Part:

  • Go to github and download all the scripts of  ORDS 18.2 from  Oracle GitHub 
    • Refer readme doc on the github to understand how dockfile works on ORDS
    • Download ORDS 18.2 from OTN 
    • put them into directory (ie  /u01/build/ords )
    • cd /u01/build/ords  and  docker build -t oracle/restdataservices:v1 .
    • It will build docker images for ORDS
    • To create volumes outside docker to hold all datafiles and related config files
      • mkdir -p /u01/build/ords/config/ords
      • chown -R 54321:54321   /u01/build/ords/config/ords    (54321 is the UID of oracle user from Docker image)
docker run -itd --name testords1 \
--network=ltest_network \
-p 7777:8888 \
-e ORACLE_HOST=<hostname> \
-e ORACLE_PORT=1528 \
-e ORACLE_SERVICE=ltestpdb \
-e ORACLE_PWD= <password> \
-e ORDS_PWD=<password> \
-v /u01/build/ords/config/ords:/opt/oracle/ords/config/ords \
oracle/restdataservices:v1
      • it will create a new ORDS standalone and install ORDS schema  for you
      • We can run this command again and again. It will detect the config file which  was created , not create a new one
      • use  'docker logs testords1 '   to check status
      • use  'docker exec -t testords1  /bin/bash'   to  get into the docker  container to inspect

No comments: