Installing JDeveloper SOA Suite in a Docker container
Who is an Oracle SOA Developer knows how is painful always you need to install or reinstall your workstation.
Creating a customized image of your development environment can reduce time of onboarding new people to the team, standardize tools and can improve performance of the developers.
A good option is using docker container images to distribute your customized development environment to developers.
In this article I share with you an example of a docker image creation based on Oracle Docker Images.
Objectives:
- Describe the Dockerfile to build a customized image with SOA Suite Quick Start installed;
- Build a docker image;
- Run a container and test.
Pre-requisite:
- Have docker installed on your machine. Instructions for linux here, for Windows and Mac you can install Docker Desktop.
Dockerfile:
You can find the project files in this GitHub repository (https://github.com/damasiormoura/soasuitequickstart_docker_image). Download or clone it.
The dockerfile is under dockerfiles/12.2.1.4/ folder.
1- First step is to define base image for our customized one. I choose oracle/serverjre:8 because it has most recent server jre 8 running in Oracle Linux 7.
2- Create environment variables and oracle user to run SOA Suite installation.
3- Copy installers and scripts from host to image.
4- Run silent mode SOA Installation.
5- Apply patches if available.
6- Rebuild from original image. It is meant to make result image clean of unnecessary files, such as installers and temporary files used in installation. Copy only useful files.
7- Install additional applications.
8- Define a initial application to run. For this case I choose JDeveloper.
Building the Java 8 (Server JRE) base image
Download or clone GitHub Oracle Repository (https://github.com/oracle/docker-images)
Download Server JRE 8 .tar.gz file and drop it inside the folder ../OracleJava/java-8.
Build it using:
$ cd ../OracleJava/java-8 $ docker build -t oracle/serverjre:8 .
Result:
Sending build context to Docker daemon 55.46MB Step 1/13 : FROM oraclelinux:7-slim as builder 7-slim: Pulling from library/oraclelinux 79ccf0f4e30f: Already exists Digest: sha256:852537aefd7f786be9573d1207ef25de969c9ad19a0216aadae4599a24d281b3 Status: Downloaded newer image for oraclelinux:7-slim ---> f23503228fa1 Step 2/13 : MAINTAINER Aurelio Garcia-Ribeyro <aurelio.garciaribeyro@oracle.com> ---> Running in a95ae56625c4 Removing intermediate container a95ae56625c4 ---> fff527e0e96f Step 3/13 : RUN set -eux; yum install -y gzip tar ; rm -rf /var/cache/yum ---> Running in be57e2c2b0b2 + yum install -y gzip tar Loaded plugins: ovl Resolving Dependencies --> Running transaction check ---> Package gzip.x86_64 0:1.5-10.el7 will be installed ---> Package tar.x86_64 2:1.26-35.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: gzip x86_64 1.5-10.el7 ol7_latest 129 k tar x86_64 2:1.26-35.el7 ol7_latest 845 k Transaction Summary ================================================================================ Install 2 Packages Total download size: 974 k Installed size: 2.9 M Downloading packages: -------------------------------------------------------------------------------- Total 1.3 MB/s | 974 kB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 2:tar-1.26-35.el7.x86_64 1/2 Installing : gzip-1.5-10.el7.x86_64 2/2 Verifying : gzip-1.5-10.el7.x86_64 1/2 Verifying : 2:tar-1.26-35.el7.x86_64 2/2 Installed: gzip.x86_64 0:1.5-10.el7 tar.x86_64 2:1.26-35.el7 Complete! + rm -rf /var/cache/yum Removing intermediate container be57e2c2b0b2 ---> a5cbdcc48ad7 Step 4/13 : ENV LANG en_US.UTF-8 ---> Running in 6e8b382599d5 Removing intermediate container 6e8b382599d5 ---> b33858378210 Step 5/13 : ENV JAVA_PKG=server-jre-8u251-linux-x64.tar.gz JAVA_SHA256=af737e1315e2b211b88f24ee632d24c192e0b3a802625f367ae1b80a00fd4546 JAVA_HOME=/usr/java/jdk-8 ---> Running in 61531647f08f Removing intermediate container 61531647f08f ---> 21a153a82de9 Step 6/13 : COPY $JAVA_PKG /tmp/jdk.tgz ---> cf5289e4e012 Step 7/13 : RUN set -eux; echo "$JAVA_SHA256 */tmp/jdk.tgz" | sha256sum -c -; mkdir -p "$JAVA_HOME"; tar --extract --file /tmp/jdk.tgz --directory "$JAVA_HOME" --strip-components 1; rm /tmp/jdk.tgz ---> Running in 9ba6dcda383b + echo 'af737e1315e2b211b88f24ee632d24c192e0b3a802625f367ae1b80a00fd4546 */tmp/jdk.tgz' + sha256sum -c - /tmp/jdk.tgz: OK + mkdir -p /usr/java/jdk-8 + tar --extract --file /tmp/jdk.tgz --directory /usr/java/jdk-8 --strip-components 1 + rm /tmp/jdk.tgz Removing intermediate container 9ba6dcda383b ---> 3962af21aa3b Step 8/13 : FROM oraclelinux:7-slim ---> f23503228fa1 Step 9/13 : ENV LANG en_US.UTF-8 ---> Running in a56f9400337a Removing intermediate container a56f9400337a ---> 09a16c4d02a2 Step 10/13 : ENV JAVA_VERSION=1.8.0_251 JAVA_HOME=/usr/java/jdk-8 ---> Running in c7776733c5b3 Removing intermediate container c7776733c5b3 ---> 396138733f45 Step 11/13 : ENV PATH $JAVA_HOME/bin:$PATH ---> Running in 24b11581b90c Removing intermediate container 24b11581b90c ---> 26d721d35bc8 Step 12/13 : COPY --from=builder $JAVA_HOME $JAVA_HOME ---> 76899a3374b3 Step 13/13 : RUN ln -sfT "$JAVA_HOME" /usr/java/default; ln -sfT "$JAVA_HOME" /usr/java/latest; for bin in "$JAVA_HOME/bin/"*; do base="$(basename "$bin")"; [ ! -e "/usr/bin/$base" ]; alternatives --install "/usr/bin/$base" "$base" "$bin" 20000; done; java -Xshare:dump; java -version; javac -version ---> Running in 6c0f5183dca1 Allocated shared space: 37871616 bytes at 0x0000000800000000 Loading classes to share ... Preload Warning: Cannot find sun/security/provider/DSA$LegacyDSA Loading classes to share: done. Rewriting and linking classes ... Rewriting and linking classes: done Number of classes 2572 instance classes = 2558 obj array classes = 6 type array classes = 8 Calculating fingerprints ... done. Removing unshareable information ... done. Shared Lookup Cache Table Buckets = 8216 bytes Shared Lookup Cache Table Body = 65336 bytes ro space: 7374232 [ 36.2% of total] out of 16777216 bytes [44.0% used] at 0x0000000800000000 rw space: 11279424 [ 55.4% of total] out of 16777216 bytes [67.2% used] at 0x0000000801000000 md space: 1683488 [ 8.3% of total] out of 4194304 bytes [40.1% used] at 0x0000000802000000 mc space: 34053 [ 0.2% of total] out of 122880 bytes [27.7% used] at 0x0000000802400000 total : 20371197 [100.0% of total] out of 37871616 bytes [53.8% used] java version "1.8.0_251" Java(TM) SE Runtime Environment (build 1.8.0_251-b08) Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode) javac 1.8.0_251 Removing intermediate container 6c0f5183dca1 ---> 680713fa199b Successfully built 680713fa199b Successfully tagged oracle/serverjre:8
Build SOA Suite Quick Start image
You can find the project files in this GitHub repository (https://github.com/damasiormoura/soasuitequickstart_docker_image). Download or clone it.
To build the Oracle SOA Suite QuickStart image, you must first download the required version of the Oracle SOA Suite Quick Start binaries. This install binary is required to create the Oracle SOA Suite Quick Start image. This binary must be downloaded unzipped and copied into the folder with the same version for e.g. 12.2.1.4.0 '../dockerfiles/12.2.1.4/install'.
The binaries can be downloaded from the [Oracle Software Delivery Cloud](https://edelivery.oracle.com). Search for "Oracle SOA Suite" category Release and download the version, which is required, for e.g. 12.2.1.4.0 is available under 'Oracle Fusion Middleware 12c (12.2.1.4.0) Business Process Management Quick Start for Developers'. This installation is divided into two files.
Extract the downloaded zip files and copy `fmw_12.2.1.4.0_soa_quickstart.jar`, `fmw_12.2.1.4.0_soa_quickstart2.jar` files under `dockerfiles/12.2.1.4/install` for building Oracle SOA 12.2.1.4 image.
Build the Oracle SOA Quick Start 12.2.1.4 image using:
$ cd dockerfiles/12.2.1.4 $ docker build -t soaquickstart:12.2.1.4 .
Result:
{...}
Successfully tagged soaquickstart:12.2.1.4
Create a container and run
Execute:
$ docker run --name my-soa-environment -ti --env DISPLAY=host.docker.internal:0.0 -v D:\HostSharedFolder:/mnt/host soaquickstart:12.2.1.4
If you are using a Windows Host, you need to install an X Terminal Server like Xming (http://www.straightrunning.com/XmingNotes/index.php).
Substitute "D:\HostSharedFolder" for a local host directory to container have access. You can use this folder as persistent store for your project files.
Voila! Here is your JDeveloper.
Start container if not first time (Launch Jdeveloper)
$ docker start my-soa-environment
Start other application from the container. Examples:
- bash
$ docker exec -it my-soa-environment bash
- config new or update Weblogic domains
$ docker exec -it my-soa-environment oracle_common/common/bin/config.sh
- any other command
$ docker exec -it my-soa-environment <your_command_here>
stop container
$ docker stop my-soa-environment
NOTE: If you close JDeveloper, the container will stop, because it is the root process defined in Dockerfile.
Conclusion
Now, you can build your own customized images and reduce your environment settings deployment problems.
Wow, excelente ejercicio. Gracias Rodrigo.
Muito bom o artigo Rodrigo Damasio de Moura. Parabéns!
Muito bom, Se eu um dia for usar inicialmente eu faria somente uma modificação inicial no Dockerfile de montar um volume para poder compartilhar meus repositórios entre o container e minha maquina.
Good!!!