Thursday, January 18, 2018

The docker-compose for Oracle 12c XE

Oracle Database Express Edition

After a while got time to explore the new learning in my way. Oracle Express edition on docker container is my goal. In this post I am going to explain you how did I achieved this with different path of using docker-compose commands to bringing up the automated XE container. The regular choice is defined in GitHub and Docker hub it was mentioned to use docker pull and docker run commands to use.

Advantages of containerizing Oracle 12c XE

  • No need to download any software from OTN
  • No need to install - dockerfile will take care of it
  • No need to run dbca for Database cration - executed moment container boot time
  • No need to start LISTENER, STARTUP database because this container choosen is AUTOMATED [OK]

Lets search for the Oracle 12c XE

docker search oracle12c

Output of docker search result
Docker Oracle 12c XE search

The docker-compose for Oracle 12c XE Database

 image: rodrigozc/oracle12c
  - "1521:1521"
  - "8089:8080"
  - "2222:22"

docker-compose config
networks: {}
    image: rodrigozc/oracle12c
    network_mode: bridge
    - 1521:1521
    - 8089:8080
    - '2222:22'
version: '2.0'
volumes: {}

docker-compose up -d
Creating oraclexe_oracle12cxe_1

Now lets check the docker-compose wit running process list
 docker-compose ps
         Name                Command       State                                  Ports
oraclexe_oracle12cxe_1   /    Up>1521/tcp,>22/tcp,>8080/tcp

SSH Connection with port 2222

Using PuTTY terminal you can connect to the container that is running Oracle 12c XE database in it.

Oracle XE docker container SSH connection

check logs what is happening in the container when it was just started...

vagrant@docking ~/oracle_xe $ docker-compose logs oracle12cxe
Attaching to oraclexe_oracle12cxe_1
oracle12cxe_1  | SSH server started. ;)
oracle12cxe_1  | ls: cannot access /u01/app/oracle/oradata: No such file or directory
oracle12cxe_1  | Database not initialized. Initializing database.
oracle12cxe_1  | Starting tnslsnr
oracle12cxe_1  | Copying database files
oracle12cxe_1  | 1% complete
oracle12cxe_1  | 3% complete
oracle12cxe_1  | 11% complete
oracle12cxe_1  | 18% complete
oracle12cxe_1  | 37% complete
oracle12cxe_1  | Creating and starting Oracle instance
oracle12cxe_1  | 40% complete
oracle12cxe_1  | 45% complete
oracle12cxe_1  | 50% complete
oracle12cxe_1  | 55% complete
oracle12cxe_1  | 56% complete
oracle12cxe_1  | 60% complete
oracle12cxe_1  | 62% complete
oracle12cxe_1  | Completing Database Creation
oracle12cxe_1  | 66% complete
oracle12cxe_1  | 70% complete
oracle12cxe_1  | 73% complete
oracle12cxe_1  | 85% complete
oracle12cxe_1  | 96% complete
oracle12cxe_1  | 100% complete
oracle12cxe_1  | Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/xe/xe.log" for further details.
oracle12cxe_1  | Configuring Apex console

Here the log file shows that installation successful. And Now lets check the Expression Edition Enterprise manager console

Oracle Enterprise Manager database express 12c Login page
Please enter the the login credentials as: sys/oracle select the check box as sysdba option. Because we want to do a DBA task now create user.

After login successful you will get the SYSDBA access.

Create User on Oracle 12c EM Console
Create User account as demouser 

Tablespaces for demouser

Assign privileges RESOURCE, CONNECT to demouser

Create User SQL statement processed succesfully

In the PuTTY terminal connect with oracle/welcome1 ssh credentials.
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/xe

To check Oracle Database running with process that have pmon word:
 ps -ef|grep pmon
You can check for the Oracle database configured and the Listener started with script.
lsnrctl status

LSNRCTL for Linux: Version - Production on 04-SEP-2017 19:16:36

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version - Production
Start Date                04-SEP-2017 18:33:10
Uptime                    0 days 0 hr. 43 min. 26 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/38a4e2e216dd/listener/ale     rt/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=38a4e2e216dd)(PORT=8080))(Presentati     on=HTTP)(Session=RAW))
Services Summary...
Service "" has 1 instance(s).
  Instance "xe", status READY, has 1 handler(s) for this service...
Service "" has 1 instance(s).
  Instance "xe", status READY, has 1 handler(s) for this service...
The command completed successfully

Confirm the User creation

Using SQL*Plus you can test the connection to the demouser that created in the above section.

 sqlplus demouser/welcome1@localhost:1521/""

Output looks like this:

connection validation using SQL*Plus

You can also define your own SID and use that for creating RCU and move further.

Please share your feedback on this experiment how it helps you and any suggestions to improve more posts on containerization in Oracle DevOps.


Git Hub link for Oracle 12c+ SSH 
Docker hub link of Rodrigozc

Monday, July 24, 2017

2. Writing Dockerfiles to install Java 8 and WebLogic 12c to create docker images

We have couple of options to create the docker images. In the last post we got the docker installed Linux environment available. Now in this post we will develop the Dockerfile such that it can create an image that can have Java JRE installed and WebLogic 12c installed.

Lets jump on the task where we will prepare, create the Dockerfile and build the image and run the container to check all done successful.

Prepare software installation

Remember that official images always preferable choice. When you search for docker images from public repository that is We might get huge list some of them are Automated some of them are not.Only one will be committed as Official image. Here selecting image is also a strategy, logic inside. So carefully proceed further.

We need to install Java Development Kit JDK latest version and WebLogic in silent mode installation.

Step 1: Copy installers to data folder this is my convention I've used
Here few Dockerfile commands

FROM - used to specify the base image
MAINTAINER - tell about author
RUN - executable commands separated by &&
USER - like su command in Linux is used for switch user
ENV - environment variables definitions predefined
ADD - share directories or files
WORKDIR - login is like cd in Linux you perform some of the commands there and then you can use one more time and perform
COPY - copy the files from host machine to container it is like scp
CMD - Execute command where you can give multiple commands in double quotes
ENTRYPOINT - when container started immediately this instruction will be executed

Now we are good to go for creating the Dockerfile as follows:

# --------------------------
# Pull base image
# ---------------
FROM dnraikes/oraclelinux-7:latest

# Maintainer
# ----------
MAINTAINER Pavan Devarakonda 

RUN mkdir -p /u01 /data && \
    chmod a+xr /u01 && \
    useradd -b /u01 -d /u01/oracle -m -s /bin/bash oracle && \
    chown oracle:oracle -R /u01 && \
    chown oracle:oracle -R /data

USER oracle


ADD ./data /data
ADD ./silent /u01/silent
ADD /u01/

RUN /u01/

I'm just doing this experiment how much size this container would make that really matters.
Step 2: Copy silent folder containing wls_install.rsp, oraInst.loc with appropriate group and inventory location. Ref : Single hit installation of WebLogic 12c on Vagrant box

JDK, WebLogic Installation

Revisiting last blog post few changes made which will be help you to prepare the docker image while it creates image it will install JDK and WebLogic into the intermediate containers.

# This script will be installing JDK installing WebLogic in silent mode
#- Info
#-    Author   : Pavan Devarakonda
#-    Date     : 30-March-2017


echo "installing JDK ${JDK_INSTALLER}"

ls -l
echo confirm JDK installation
cd $INSTAL_LOC/jdk*

echo "export JAVA_HOME=$JAVA_HOME">>$HOME/.bashrc
echo "export PATH=$JAVA_HOME/bin:$PATH">>$HOME/.bashrc

. $HOME/.bashrc

echo "Check for java version"
java -version

echo Installing WebLogic now...


java -jar $WLS_INSTALLER_PATH/$WLS_INSTALLER -silent -invPtrLoc $SILENT_DIR/oraInst.loc -responseFile $SILENT_DIR/wls_install.rsp

echo "WebLogic $WLS_INSTALLER installed successfully...."
echo .
echo setting MW_HOME ...
MW_HOME=`grep ORACLE_HOME $SILENT_DIR/wls_install.rsp |cut -d'=' -f2`
echo "export MW_HOME=$MW_HOME">>$HOME/.bashrc
echo "export WL_HOME=$MW_HOME/wlserver">>$HOME/.bashrc
echo "alias wlst=$MW_HOME/oracle_common/common/bin/">>$HOME/.bashrc
. $HOME/.bashrc

Step 3: Run the docker build as follows:

# ################## #
# ################## #
echo "Building image '$IMAGE_NAME' ..."


BUILD_START=$(date '+%s')
docker build --force-rm=$NOCACHE --no-cache=$NOCACHE -t $IMAGE_NAME . || {
  echo "There was an error building the image."
  exit 1
BUILD_END=$(date '+%s')

echo ""

chmod u+x

After weblogic docker image build completed you can see the following lines at the end:
Successful execution of docker build

The docker image list looks as follows:

WebLogic docker image
Further experimenting on dockerization of WebLogic - Using containers will be posted soon.


  1. GitHub link for Oracle-WebLogic docker build

Blurb about this blog

Blurb about this blog

Essential Middleware Administration takes in-depth look at the fundamental relationship between Middleware and Operating Environment such as Solaris or Linux, HP-UX. Scope of this blog is associated with beginner or an experienced Middleware Team members, Middleware developer, Middleware Architects, you will be able to apply any of these automation scripts which are takeaways, because they are generalized it is like ready to use. Most of the experimented scripts are implemented in production environments.
You have any ideas for Contributing to a Middleware Admin? mail to me