Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

WebLogic on Docker Containers Series — Part 2

DZone's Guide to

WebLogic on Docker Containers Series — Part 2

In my previous post, I showed how to create a base Docker image with WebLogic and Oracle JDK installed and then how to create a second image that contains a configured WebLogic domain. Today's post will break down what happens behind the scenes of that process.

· DevOps Zone
Free Resource

Learn more about how CareerBuilder was able to resolve customer issues 5x faster by using Scalyr, the fastest log management tool on the market. 

In my previous post, the first part of this series, I've shown to you how to quickly get started with WebLogic on Docker. You've learned how to create a base Docker image with WebLogic and Oracle JDK installed,and then how to create a second image that contains a configured WebLogic domain. Today's post will break down what happens behind the scenes of that process.

Note: For the sake of keeping this blog post useful in the future, I will refer to the commit 7741161 from the docker-images GitHub project, and version 12.2.1 of WebLogic.

Walking Through the Build Process of a WebLogic Base Image

A base image of WebLogic means an image that contains only the software installed with minimum configuration to further be extended and customized. It may be based on a Red Hat base Docker image, but preferably, we recommend you to use the Oracle Linux base image.

Samples for how to build a base image are presented in the dockerfiles folder. Files for WebLogic versions 12.1.3 and 12.2.1 are maintained there, available in two kinds of distributions: Developer and Generic. Other versions and distributions may be added in the future.

Differences Between Developer and Generic Distributions

There aren't many differences between them, except these (extracted from the README.txt file inside the Quick Installer for Developer):

WHAT IS NOT INCLUDED IN THE QUICK INSTALLER

- Native JNI libraries for unsupported platforms.
- Samples, non-english console help (can be added by using the WLS supplemental Quick Install)
- Oracle Configuration Manager (OCM) is not included in the Quick installer
- SCA is not included in the Quick Installer

Also, the Quick Installer for Developers is compressed using pack200, an optimized compression tool for Java classes and JAR files, to reduce the download size of the installer. Besides these differences, the two distributions work perfectly fine for Java EE development and deployment.

Building the Developer Distribution Base Image

Although we provide a handy shell script to help you in this process, what really matters relies inside 12.2.1 folder and the Dockerfile.developer file. That recipe does a COPY of two packages, the RPM of JDK and the WebLogic Quick Installer. These files must be present. We've put these .download files as placeholders to remind you of the need to download them. This same approach will apply for the Generic distribution.

The installation of JDK uses rpm tools, which enables us to run Java inside the base image—a very obvious requirement. After JDK is installed, we proceed with the installation of WebLogic by simply calling "java -jar", and later we clean up yum.

An important observation is the use of /dev/urandom in the Dockerfile. WebLogic requires some level of entropy for random bits that are generated during install, and as well domain creation. It is up to customers to decide whether they want to use /dev/random or /dev/urandom. Please configure this as desired.

You can build this image in two ways:

  1. Using buildDockerImage.sh script. Indicate you want developer distribution [-d], and version 12.2.1 [-v 12.2.1].

    $ pwd
    ~/docker-images/OracleWebLogic/dockerfiles
    $ sh buildDockerImage.sh -d -v 12.2.1

  2. Manually calling docker build:

    $ cd 12.2.1
    $ docker build -t oracle/weblogic:12.2.1-dev -f Dockerfile.developer .

Either of these calls result in the following:

REPOSITORY          TAG            IMAGE ID         CREATED          VIRTUAL SIZE
oracle/weblogic     12.2.1-dev     99a470dd2110     15 secs ago      1.748 GB
oraclelinux         7              bea04efc3319     5 weeks ago      206 MB
oraclelinux         latest         bea04efc3319     5 weeks ago      206 MB

As you may know by now, this image contains only WebLogic and JDK installed, and thus does not serve to be executed, only to be extended.

Building the Generic Distribution Base Image

Most of what you've learned from above applies to the Generic distribution. The differences are that you must download, obviously, the Generic installer. The installation process is a little bit different, since it uses the silent install mode with environment definition coming from install.file and oraInst.loc.

To build this image you can either:

  1. Call buildDockerImage.sh script. Indicate you want Generic distribution [-g], and version 12.2.1 [-v 12.2.1].

    $ pwd
    ~/docker-images/OracleWebLogic/dockerfiles
    $ sh buildDockerImage.sh -g -v 12.2.1

  2. Manual call docker build:

    $ cd 12.2.1
    $ docker build -t oracle/weblogic:12.2.1 -f Dockerfile.generic .

Now you have two images you can extend from, either the Developer or the Generic base image:

REPOSITORY          TAG            IMAGE ID         CREATED          VIRTUAL SIZE
oracle/weblogic     12.2.1         ea03630ee95d     18 secs ago      3.289 GB
oracle/weblogic     12.2.1-dev     99a470dd2110     2 mins ago       1.748 GB
oraclelinux         7              bea04efc3319     5 weeks ago      206 MB
oraclelinux         latest         bea04efc3319     5 weeks ago      206 MB 

Note how the Generic image is larger than the developer image. That's because the Developer distribution contains less stuff inside, as described earlier. It will be up to Dev and Ops teams to decide which one to use and how to build them.

In the next post, I will walk you through the process of building the 1221-domain sample image.

If you have any questions, feel free to comment, or tweet.

Find out more about how Scalyr built a proprietary database that does not use text indexing for their log management tool, allowing customers to search 1TB of data in under a second. 

Topics:
docker ,weblogic ,cloud ,oracle

Published at DZone with permission of Bruno Borges. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}