X

Antony Reynolds' Blog

Building an FMW Cluster using Docker (Part II Building Docker Images)

Antony Reynolds
Senior Director Integration Strategy

Click here for a Google Docs version of this document that doesn't suffer from the Oracle blog formatting problems


 

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.

  • Oracle Linux is an image that we use as our starting point.  This is available from github along with instructions (dockerfiles) to create the other images.
  • Oracle Database image is created by installing the Oracle database binaries into the Oracle Linux image.  This image can be used to create databases with different characteristics, such as different character sets, different service and instance names etc.
  • An Oracle Database Instance is created by running the database configuration assistant in a container created from the Oracle Database image.
  • JDK 8 image is created by installing a JDK 8 into the generic Linux image, this could be reused by any software requiring Java.
  • Fusion Middleware Infrastructure image is created by installing the WebLogic Fusion Middleware Infrastructure into the JDK image.  This provides WebLogic and some additional Oracle infrastructure files that are used by Fusion Middleware.  This image can be reused by any Fusion Middleware product image.
  • Oracle Service Bus image provides us with Service Bus installation on top of the Fusion Middleware Infrastructure image.  This provides a software only installation, no domain is created so the image can be used to create any desired Service Bus domain configuration.
  • Service Bus Domain image is the image where we run the domain configuration utility to create a Service Bus domain.  Prior to running the domain configuration wizard the FMW repository configuration utility is run against the database container created from the Oracle Database Instance image.  Depending on the options chosen this could be pointed to and used by a number of different FMW components.  In our case we will install the SOA schemas. We need to refer to the Oracle Database Container to be able to run the RCU and also to complete the domain creation.  Different run commands are used to start a container to run either the Admin Server or a Managed Server.

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:

  • Java - we used the JDK rather than the JRE.
  • WebLogic - we added a 12.2.1.2 FMW Infrastructure alongside the generic and developer options.  This is available in other versions of the Oracle files but not in the 12.2.1.2 files.
  • OSB and SOA - Added OSB and SOA directories along with their associated 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.

  • We will install JDK 8 to create a JDK 8 image.  This can be used to create any image requiring a JDK 8 installation.  This if built on top of the Oracle Linux 7 image.
  • We build on top of the JDK 8 image to install Fusion Middleware Infrastructure into a WebLogic FMW Infrastructure image.  This can be used as the basis of any FMW images in the future.
  • In our example we install SOA or OSB on top of the WebLogic FMW Infrastructure image as our FMW component.  This does not create a domain.  It just installs the software.

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

  • linuxamd64_12102_database_1of2.zip
  • linuxamd64_12102_database_2of2.zip

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

  1. Build Oracle Database Docker Image

  • Create a Docker Image for the database using the binaries from the previous step.  This installs the database binaries and saves the result as a docker image.  The build.sh has all the paramters needed by the dockerfile, if you are interested in what they do check out the official Oracle docker database image docs.  Note that if we don’t have the Oracle Linux image then the build process will retrieve it from docker hub.

<MASTER>/OracleDatabase/build.sh

  • Check the image has been built properly by making sure it is listed by the docker images command.

$ 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

  • Run a docker container based on the previously built docker image to create the database instance.  The create_db.sh command that we provide will do this.  Again the details of how it works are in the official Oracle docker database image docs.  We also added a -d parameter to run the container in the background.

./create_db.sh

  • Check container logs
    docker logs <container_id>
  • Change DB password by running the set_db_password.sh we provide which sets the database password to be FMWDocker.  You can edit the file to change the password.  We also modified this file to set the password policy to not expire the passwords.

./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

  • Go to <MASTER>/oraclejdk8 folder
  • Download jdk 8 install binary file, jdk-8uXXX-linux-x64.tar.gz from OTN into oraclejdk8 folder.  Any version that starts jdk-8 should work.
  • Run build.sh

./build.sh

  • Check that image has been created

$ 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

  • Go to folder <MASTER>/wls12.2.1.2
  • Download fmw_12.2.1.2.0_infrastructure_Disk1_1of1.zip from OTN to folder wls12.2.1.2
  • Run build.sh

./build.sh

  • Run docker images to check the image created in the above steps

$ 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

  • Go to folder <MASTER>/osb
  • Download fmw_12.2.1.2.0_osb.jar from OTN to folder osb.  If unavailable on OTN it is available from e-delivery if you have a Service Bus license.
  • Run build.sh

./build.sh

  • Check docker image built in the above step

$ 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.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.