Over a million developers have joined DZone.

New Features for Managing Web Sphere Liberty Docker Containers

DZone's Guide to

New Features for Managing Web Sphere Liberty Docker Containers

This post will take you through the steps you'll use to manage Liberty docker containers with the September 2015 preview management function.

· Cloud Zone ·
Free Resource

Learn how to migrate and modernize stateless applications and run them in a Kubernetes cluster.

Special thanks to Chris Vignola, co-author of this article.

The September 2015 Liberty Beta includes a preview of management function for Liberty Docker containers. A Liberty Docker container is a Liberty Server packaged and deployed through a Docker image. New in this beta is collective management for these containers. This is a continuation of Liberty’s embrace of Docker, which started with the publishing of a Liberty Docker image on Docker Hub.

The management functions for Liberty Docker containers in this beta include: collective registration, Admin Center visualization and operations, and phase 1 auto-scaling. Collective registration is simply the use of the collective join command to add a Liberty Docker container to a collective for management. Once a member of a collective, the Liberty Docker container is visible in the Admin Center. Status, start, and stop operations are available. Finally, you can configure the image to be scalable, using Liberty’s scaling controller feature. “Phase 1” simply means the beta auto-scaling function is limited to a subset of the full auto-scaling capability regular Liberty servers enjoy.

The following diagram depicts the workflow for building, publishing, and deploying Liberty Docker images to a collective and creating containers

beta article artwork

  1. Start by using your favorite developer tools to create your application on a Liberty server. Package and publish your app and its dependencies as a Docker image. Detailed instructions are located at the Beta Knowledge Center, including an example Dockerfile.
  2. Pull your Docker image to a Docker Host (i.e. a system that has the Docker engine running) and create a Liberty container.
  3. Join the Liberty container to the collective and bang! You can view and control your Liberty container through the Liberty Admin Center. The scripts you need to join and remove a Liberty server from the container are: joinMember script: 
memberHost="$(hostname -i)"
/opt/ibm/wlp/bin/collective join defaultServer --host=$controllerHost --port=$controllerPort --user=$controllerUser --password=$controllerPassword --hostName=$memberHost --createConfigFile --keystorePassword=$memberKeystorePassword --containerName=$containerName --containerHost=$containerHost --autoAcceptCertificates
mkdir /opt/ibm/wlp/usr/servers/defaultServer/configDropins
mkdir /opt/ibm/wlp/usr/servers/defaultServer/configDropins/overrides
mv /opt/ibm/wlp/usr/servers/defaultServer/c*.xml /opt/ibm/wlp/usr/servers/defaultServer/configDropins/overrides
rm /opt/ibm/docker/env.properties
echo containerName=$containerName > /opt/ibm/docker/env.properties

removeMember script:

memberHost="$(hostname -i)"
/opt/ibm/wlp/bin/collective remove defaultServer --host=$controllerHost --port=$controllerPort --user=$controllerUser --password=$controllerPassword --hostName=$memberHost --containerName=$containerName --autoAcceptCertificates
  1. Optionally, you can configure Liberty auto-scaling to scale out your Liberty Docker image. In this beta, only the scaling policy min and max settings control the number of containers for a given image. The join and remove scripts you used in Step 3 must be placed at /opt/ibm/docker in the Docker image and named joinMember and removeMember. The Beta Knowledge Center contains an example server.xml for the Liberty server within the container.

You can see all this in motion in the following video:

You might be wondering what this support will look like once it is generally available. While we can’t make any promises, obvious improvements would include remote deployment, phase 2 auto-scaling (i.e. metrics-based, like CPU), health management, and analytics integration.

So if managing Liberty Docker containers interests you, stay tuned and watch for what comes next!

Join us in exploring application and infrastructure changes required for running scalable, observable, and portable apps on Kubernetes.

docker ,websphere

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}