Thursday, June 22, 2017

Learning docker-compose for WebLogic with examples

The docker-compose is one of the docker integration tool. it works based on yml or yaml file. The yml files are easy to read plain like English text. It is developed alternative to JSON files, both are used to store the key, value pairs and hierarchical structured data. To run docker-compose command in the current directory there should be  docker-compose.yml file must be exist.

Create docker-compose.yml file

Lets create the docker-compose.yml file for WebLogic Domain container which uses 1221-appdeploy image. The AdminServer port exposed as 7001 from the container and on left side host port opened with 7001. The container should run the command/shell script. here we can select as starting shell script to be executed when container launched.

Here the docker Compose syntax is simple human readable. alternative to JSON. meta-data.
 image: 1221-appdeploy
  - "7001:7001"

Now we are ready for Running the container with docker-compose command which will start the container and keep  it running state.

docker-compose up 

To run the docker container in the background we will use -d option

docker-compose up -d 

docker-compose for WebLogic appdeployment container
We have same number of commands as in docker for docker-compose. And it is more powerful than docker commands. because it can start multiple containers with single command.

How to check the WebLogic log files from docker host?

Docker container logs can be viewed from the docker host machine using the following command
  docker-compose logs --tail="all"

  docker-compose logs -f

How to get docker-compose process list?

We can get the list of process that are running on docker deamon.
docker-compose ps
docker-compose ps for WebLogic

How to bring down docker-compose containers?

To stop the container we can use stop option
docker-compose stop

To destroy and dispose you can use down option.
docker-compose down

It will stop and remove the container.

Destroying the container will loss all the changes in the last domain configuration. Better to have host volume shared or have a separate container to have weblogic domains for backup.

Sunday, May 21, 2017

Learning dockerization for WebLogic on Oracle Linux in Vagrant

Writing this blog post after couple of executions experiments and research on docker. The basic requirement for docker is there must be a Linux/Unix based platform. Here I am creating that one on my Windows host machine, and the guest Ubuntu Trusty64 platform with the help of Vagrant and Oracle Virtualbox provider.

vagrant Ubuntu docker - Oracle Linux images

Create testnode1 folder on the Windows machine. I've created on F:\testnode1.

The Vagrantfile to launch Ubuntu Trusty64 Virtual machine is as follows:


# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
  config.vm.define "test" do |testnode1| = "williamyeh/ubuntu-trusty64-docker"
 testnode1.vm.hostname="" "private_network", ip: ""
  config.vm.synced_folder "F:/Softwares", "/u01/app/software"
  config.vm.provider "virtualbox" do |vb|
 vb.memory = "4096"
   config.vm.provision "shell",
    inline: "/bin/bash /u01/app/software/"

After Vagrant up looks like this

In the Trusty64 terminal the shell script will be executed first time. Next time onwards it will verify and shows message already executed.

Note that this vagrant box built-in with docker, and when you start the box it will automatically brings up the docker-engine.

How do I know docker installed?

Using docker info you will get to know about the docker version, status and information about daemon how much memory, CPU are allotted for it.

docker info
The docker info command execution

How do I check docker engine running?

Using regular Linux service command will tell about docker engine. Of-course docker info already tells the same in one of the line.

service docker status

Checking docker service status

Lets do dockerization

There are multiple docker commands which help you to create docker images, pull them from the global repository. Docker images will be used to generate docker containers. Here image is like blueprint and the container is like object of the blueprint.

docker search oraclelinux

docker search for oraclelinux image in public registry

Once you found your desired image then you can use pull command on docker engine then docker image will be visible.

docker pull oraclelinux7

docker pull oraclelinux-7
After pull successful your docker images stack will be updated to check use docker images command.

docker images

docker images list including oraclelinux-7
Running docker container
We can run the docker container from the pulled images, here we are interested on oraclelinux-7 image.

 docker run -i -t --name orawls --hostname dnraikes/oraclelinux-7:latest /bin/bash

Prepare software installation

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
Create 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