Oracle Fusion Middleware Deployments Using Docker Swarm Part II

Overview

This is the second in a series of blogs that describe how to build a Fusion Middleware (FMW) Cluster that runs as a number of Docker images that run in docker containers.  These containers are coordinated using Docker Swarm and can be deployed to a single host machine or multiple hosts.  This simplifies the task of building FMW clusters and also makes it easier to scale them in and out (adding or subtracting host machines) as well as up and down (using bigger or smaller host machines).

This blog uses Oracle Service Bus as an FMW product but the principles are applicable to other FMW products.

In our previous blog we talked about the overall requirements for running FMW on Docker Swarm and sketched out our overall approach.

In this entry we will explain the concepts of using Docker base images and create an Oracle database image and an Oracle Service Bus image.  The next blog will cover how to create an OSB domain and how to run this in Docker Swarm.

Notes on Building on Existing Docker Images

Docker allows you to create a new image by basing it on an existing image.  The “FROM” instruction in a dockerfile tells docker the base image that you are using as your foundation.  We will build a number of database base images that can then be reused later.

A docker image is a set of files and configuration.  A docker image runs in a docker container.  So a single image may be running in zero, one or more containers.  Think of the image as the software and configuration, think of the container as the active running image.

The diagram shows the images that we will build and their base images referenced in the FROM instruction.


Docker FMW Image Dependencies

The solid lines indicate the image reference by the FROM command in the dockerfile used to create an image.  The dotted lines represent dependencies on other images.

More details on the images will be given in the next section, but the following bullets explain how they work.  Note that we can store the created images in a company docker registry so that they can be reused.

Retrieving Docker Files for OSB Cluster

We are posting all the required files to go along with this blog on github.  You are welcome to fork from this and improve it.  We cloned many of these files from the official Oracle docker github.  We removed unused versions and added a simplified build.sh file to each product directory to make it easy to see how we actually built our environment.  We are still updating the files online and will shortly add details on building the service bus cluster.  We made the following additional changes to the standard Oracle files:

Database Creation

Because Oracle Fusion Middleware relies on a database we need to create a database image.  Once we have created the database then we need to create the FMW schemas within it by running the Repository Creation Utility.  The Repository Creation Utility is only available in the FMW installed code, so to create the schemas we also need to install our FMW component, in our case Service Bus.  The steps we will follow to build, create and configure the database are as follows:

  1. Build Oracle Database image using the Oracle provided database dockerfile.
  2. Create an Oracle Database Instance by creating a docker container and using the provided scripts to initialize the container with a database instance.

Detailed instructions to build the database image are provided in the section “Oracle Database Build Steps

We create the database instance in a docker container rather than baking it into an image because we only want to run a single instance of the database container.

FMW Installation

We will use multiple layered images to get to our FMW install image.  Each image is kept separate to make it flexible and reusable.  For example given the WebLogic FMW Infrastructure image we could create separate FMW images for SOA Suite, WebCenter and Business Intelligence for example.

Detailed steps are given in the sections “Weblogic Docker Image Build Steps” and “OSB Docker Image Build steps

General Build Instructions

You can download our dockerfiles by cloning our github onto your build machine.

git clone https://github.com/Shuxuan/OSB-Docker-Swarm.git

This will create a directory OSB-Docker-Swarm.  We will refer to the location of this as <MASTER> in subsequent instructions.

Database Docker Image Build Steps

There is an excellent blog on Creating an Oracle Database Docker image by Gerald Venzi that covers everything.  We have provided a minimal description of the steps here only to be self contained.

  1. Get Oracle Database Binaries

Retrieve the Oracle 12.1.0.2 binaries from OTN http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

  and place them at <MASTER>/OracleDatabase/dockerfiles/12.1.0.2.

  1. Build Oracle Database Docker Image

<MASTER>/OracleDatabase/build.sh

$ docker images

REPOSITORY      TAG         IMAGE ID      CREATED         SIZE

oracle/database 12.1.0.2-ee 8f0f3c5f4170  49 seconds ago  11.24 GB

oraclelinux     latest      27a5201e554e  3 weeks ago     225.1 MB

  1. Create Oracle Database

./create_db.sh

./set_db_password.sh

We now have an Oracle database instance running in a docker container.

Weblogic Docker Image Build Steps

  1. Build JDK 1.8 Docker image based on base image

./build.sh

$ docker images

REPOSITORY       TAG          IMAGE ID      CREATED         SIZE

oracle/database  12.1.0.2-ee  086a4a3541bc  34 minutes ago  11.24 GB

oracle/serverjdk 8            85aebb7b773e  22 hours ago    590.4 MB

oraclelinux      latest       27a5201e554e  3 weeks ago     225.1 MB

This JDK image is then used as a base for future images.

  1. Build Weblogic 12.2.1.2 installation image based on JDK 1.8 image

./build.sh

$ docker images

REPOSITORY        TAG                      IMAGE ID     CREATED              SIZE

oracle/weblogic   12.2.1.2-infrastructure  9eceea30c474 About a minute ago   4.096 GB

oracle/database   12.1.0.2-ee              086a4a3541bc About an hour ago    11.24 GB

oracle/serverjdk  8                        85aebb7b773e 22 hours ago         590.4 MB

oraclelinux       latest                   27a5201e554e 3 weeks ago          225.1 MB

This gives us our FMW infrastructure docker image.

OSB Docker Image Build steps

./build.sh

$ docker images

REPOSITORY        TAG                     IMAGE ID     CREATED             SIZE

oracle/osb        12.2.1.2                59021dc16e40 5 minutes ago       7.231 GB

oracle/weblogic   12.2.1.2-infrastructure 9eceea30c474 12 minutes ago      4.096 GB

oracle/database   12.1.0.2-ee             086a4a3541bc About an hour ago   11.24 GB

oracle/serverjdk  8                       85aebb7b773e 23 hours ago        590.4 MB

oraclelinux       latest                  27a5201e554e 3 weeks ago         225.1 MB

This gives us our FMW product docker image, in our case service bus.  We also provided SOA Suite dockerfiles in the git repository.

Summary

In this entry we have explained how to install Fusion Middleware and Oracle Database as Docker images, and how to create a Database container.  In our next entry we will use these images to create a cluster in swarm mode by defining swarm services for the database, WebLogic Admin Server and WebLogic managed servers.