Wednesday, December 16, 2015

WebLogic 12.2.1 on Docker

Probably everybody in IT has noticed the rising of Docker in last 2 years. Since March 2015 Oracle has certified WebLogic Server on Docker. This is good news. Beyond all buzz around containerization and Docker in particular there is great use for it. Especially during development or testing of an application for WebLogic you can benefit without too much investment (time, skills). Further, since the first day of WebLogic 12.2.1 release it is certified on Docker.

In preparation for one of my last talks lately I decided to checkout this new version. Subsequently are my experiences so far.

Using the following Environment: WebLogic 12.2.1, Mac OS 10.11 , Docker 1.9, Docker Compose 1.5 . I will not go into Docker details here. There is a lot of introductorily Docker content available on the web.

WebLogic on Docker Overview

There are no prepackaged WebLogic Docker images available (basically because of user licence agreements) so the images must be build manually from Dockerfiles (provided at GitHub). The following figure shows the needed layers of images to actually start running containers.
  • oraclelinux image - officially available from Docker Hub
  • weblogic binaries image - must be build from Dockerfile (Available on GitHub)
  • weblogic (empty) domain image - must be build from Dockerfile (Available on GitHub)
  • application image - must be build from custom Dockerfile (its your turn)


  1. Learn some Docker basic skills (if it is new to you)
  2. Download Docker Toolbox 1.9. It exists for Linux / Windows / Mac. It makes you getting started "to docker"  in seconds. (On Win / Mac it installs VirtualBox if needed)
  3. Git Clone (Update 12/20/15: it has been updated to
  4. Download JDK 8u60
  5. Download WebLogic 12.2.1 Binaries (I am building the DEV/QUICK Version here. So it is: fmw_12.
  6. Copy the JDK / WLS Binaries into the cloned workspace /OracleWebLogic/dockerfiles/12.2.1

How To: Build WebLogic 12.2.1 Developer Image

dockerfiles ak$ sh -v 12.2.1 -d

Building image 'oracle/weblogic:12.2.1-dev' based on 'developer' distribution...
Sending build context to Docker daemon 1.204 GB
Step 1 : FROM oraclelinux:7.0
7.0: Pulling from library/oraclelinux
f359075ce4d8: Pull complete
Successfully built 251b87118c43

WebLogic Docker Image for 'developer' 12.2.1 is ready to be extended: oracle/weblogic:12.2.1-dev
dockerfiles ak$ docker images
REPOSITORY                    TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
oracle/weblogic               12.2.1-dev          234ea4e45bc7        44 hours ago        1.738 GB
oraclelinux                   7.0                 707f44423637        7 weeks ago         197.2 MB

How To: Build WebLogic 12.2.1 Sample (Empty Domain) Image

This is pretty straightforward. Just change into the sample directory and kick off the docker build.

samples/1221-domain$ docker build -t enpit/samplewls:12.2.1-dev .
akmac2:1221-domain ak$ docker images
REPOSITORY                    TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
enpit/samplewls               12.2.1-dev          3861d745a0bc        44 hours ago        1.739 GB
oracle/weblogic               12.2.1-dev          234ea4e45bc7        44 hours ago        1.738 GB
oraclelinux                   7.0                 707f44423637        7 weeks ago         197.2 MB

At this point you have an image from that you can run weblogic containers. Having some Shell scripts included the image supports different types of containers to run. This is because of WebLogic Domain concept. See next Fig.

Run WebLogic AdminServer Container (the "Docker-Way")

Nothing easier then that:
akmac2:1221-domain ak$ docker run -d -p 8001:8001 --name=wlsadmin enpit/samplewls:12.2.1-dev
akmac2:1221-domain ak$

The container starts the default command from the Dockerfile which in this case is ""
(Providing a name is optional but it helps to better identify the running container)

The easiest way to get the right IP / URL to access the Admin Console is looking at the Kitematic UI in the "Ports" Tab

So in my case I access the WebLogic Admin Console . Logging in with defaults weblogic / welcome1. With the above command you can now start as many AdminServers (in its own WebLogic Domain) as you want.

Extend WebLogic Domain with Managed Servers (Classical WebLogic Topology) 

Starting Managed Server Containers is also straightforward (if the Dockerfile is working for you. I had to make some modifications. See later)
akmac2:1221-domain ak$ docker run -d --name=wlsms1 --link wlsadmin:wlsadmin -p 7001:7001 enpit/samplewls:12.2.1-dev
akmac2:1221-domain ak$

To add another managed server just run with different name parameter and map the container 7001 port to a different host (docker machine) port if you want to access the managed server directly
akmac2:1221-domain ak$ docker run -d --name=wlsms2 --link wlsadmin:wlsadmin -p 7003:7001 enpit/samplewls:12.2.1-dev
akmac2:1221-domain ak$

The Skript connects to the admin server, extends the domain by a machine (the container) and a managed server entry. Further it starts the NodeManager.

In the Admin Console you should notice the new machines and Managed Servers. (The managed server must be started manually; the Script is not doing it (Update 12/20/15: the scripts has been updated so managed server starts automatically)). In my sample I then have the following configuration

(Update 12/20/15: the following two issues might have been fixed in GitHub Repo)
Note: In order to make the above "" work for me I had to do the following modifications (and rebuilding the image of course)
(1) Issue: file not found ....
Adjust the sample 1221-domain/ Dockerfile.emptydomain.

Fix: I added the following underneath the statement "USER root"
RUN chmod +x /u01/oracle/*.sh && chown oracle:oracle -R /u01/oracle

(2) Issue: When the "" started and I try to start the managed server through Admin Console (that actually is done through the NodeManager) the process just hangs after a while... To fix that I modified the file
Change the arguments for starting the managed server with additional argument.
arguments = ' -
(It is a known "issue" on headless systems because of missing keyboard/mouse input entropy for random device)

Note: After making those changes and rebuild the "empty wls domain image" the ""-script worked as expected for me. But I noticed an increase in the image size from 1.7GB to 2.3GB. Not sure where it comes from. Maybe because I tried some other changes to make the Dockerfile work for me.  I need to investigate more and/or file an issue on that. 

Building an Java EE Application Image

Well, that's pretty straightforward. I took some existing WAR file from a tutorial (shoppingcart.war) and dockerized that app by creating a WLST Deploy script and of course a Dockerfile (that extends the WebLogic 12.2.1 Dev Domain Image)

Here is the Dockerfile:

And here the sample deploy WLST script:

Notice that the Admin Server is started during the build time in order to deploy to the AdminServer.
To build the sample Java EE application you need to run:
docker build -t enpit/shoppingcart:1.0-dev .

Now you have a dockerized simple Java EE application that you can run with

docker run -d -p 8001:8001 enpit/shoppingcart:1.0-dev

Composing and Running Multi-Container Applications

Well this should be a post for itself.  But to give you an impression for more complex scenarios: Typically you will run a database or more services that you WebLogic application is based on. Sure it is possible to link containers as shown in the previous sections but with more services it becomes a tedious task. Docker Compose helps to configure a multi-container environment that can simply be started with a single command: docker-compose up

The following docker-compose.yml file configures and links an oracle database-xe container and a weblogic container.

Here is the sample output docker compose provides (if running without -d option)
akmac2:1221-testds-app ak$ docker-compose up
Creating 1221testdsapp_oracledb_1
Creating 1221testdsapp_wlsadmin_1
Attaching to 1221testdsapp_oracledb_1, 1221testdsapp_wlsadmin_1
oracledb_1 | Starting Oracle Net Listener.

wlsadmin_1 | ..
wlsadmin_1 | ..
oracledb_1 | Starting Oracle Database 11g Express Edition instance.
wlsadmin_1 | ..
wlsadmin_1 | ..
wlsadmin_1 | Dec 16, 2015 10:19:14 PM GMT Notice WebLogicServer BEA-000360 The server started in RUNNING mode.

This should just give you an idea that simple Docker containers are just the beginning. With Docker Compose (and Docker Swarm) there is more to come.

Summary and Conclusion

Docker is fun and fast. It is easy to get started. The official provided WebLogic Dockerfiles on Github from Oracle help a lot to get started quickly. But be aware of that the Dockerfiles not meant to be perfect. Its an example how to get started and build your own WebLogic Docker images. The sample domain had to be adjusted otherwise the WebLogic JVM process did not start for me. But since the Dockerfiles are shared on GitHub it's easy to contribute. Bruno Borges and Monica Riccelli from Oracle are doing a great job in making all that to work and being certified by Oracle. Thank you guys!

For a long time WebLogic user it is untypical why port 8001 is used as default HTTP AdminServer Port. Why not running it on 7001 and use 8001 for Managed Server? or 7003, 7005 etc for managed server. ? (Note to me: Open an discussion on GitHub and fix that)

When running the ManagedServer (MS) type of container the MS is not started automatically. With some WLST scripting it could be improved I think.

Using docker-compose it should be possible to set up a cluster configuration and easily run it with: docker-compose up.

With Docker 1.9 Networking / Persistent storage capabilities and accordingly Docker Compose and Swarm has been greatly improved. This is great news. As it is going to allow Multi-Host WebLogic Cluster Containers. (Update 12/20/15: Multi-Host WebLogic Cluster Sample has been added in the corresponding GitHub Repo. Kudos to Bruno; great work!)

So there is still changes going on but in terms of simplification and improvement. I hope to see Docker Compose And Swarm for WebLogic working soon. But it will need some time because compose/swarm is sill experimental. There might be some networking issues at the moment of this writing.

Further information

Check out the presentation from DOAG 2015 (GER)


  1. Thanks for an excellent post and for sharing the work we've been doing. I'd like to point a few things for visitors who may come to this blog post:

    - the repository is now called "docker-images" and it sits under
    - the samples folder has been slightly reorganized
    - the sample WLST script now starts the Managed Server automatically, after it is added
    - the Managed Server startup argument now has to ensure it uses /dev/urandom for entropy when started
    - a sample for multihost networking has been produced and is published under samples/1221-multihost. It uses Docker Machine though.
    - issue with not being found has been fixed

    It is important to note again, that all these scripts are samples and pointers on how to get started, but they are not certified or supported by Oracle. What we support w.r.t. WebLogic on Docker, is documented in the links that Andreas shared at the end of this article.

  2. Hi Bruno,

    thanks for the quick reply and fixes. I put some "Update on 12/20/15: ..." comments (in green) in the original post to reflect the recent changes.

    Thanks again for your continuous community engagement plus making WLS working on Docker!

  3. I think your post makes it easy to run weblogic in docker, however I don't really see this usable in a real life enterprise environment with multiple managed servers spanning over more servers. Especially node manager, trust and credentials. It's very seldom that you have a 1:1 weblogic, and applications because it's a J2EE container.

    Can you share your ideas on this matter?

  4. @Stefan: That's a good point. First of all, it is good that Oracle Supports its topology on Docker Containers. Customers can start using containers with there known WebLogic topologies. The future might be the "docker-way" (smaller deployments, microservices, etc) but it implies a redesign in architecture for existing Java EE Applications. This may take some time...

  5. Thank you guys (Andreas and Bruno) for your blogs and samples!!

  6. Hi Andreas, I have an issue about restarting managed servers containers. After the restart (docker stop container_name/ docker start container_name), the managed server in the weblogic console is always shown as a new server with a different name than the original server. The original server also remains in the console but it's in the SHUTDOWN state. So I always have to delete the origin servers which was working before the restart. It is a bug or feature? Thank you.

  7. @Ibraso, try latest scripts from the sample 1221-domain. This issue has been fixed.

    1. Scripts from the 1212-domain work fine. Thanks.

  8. @Bruno I am struggling to run wls on multi-host, followint your github workshop link

    runnung into issues when Iam running , docker-machine create -d virtualbox .

    I am trying your workshop on VirtualBox VM , also tried installing virtualbox inside that VM , still not able to run successfully.

    Any instructions missed regarding this part to be taken care before starting on this workshop ? (I am running this on VirtualBox VM with CentOS 7)

  9. @gsn Admin please reach out to Github / Twitter to contact Bruno.