Skip to content
Source to Image Builder for Open Liberty Applications on OpenShift
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Source To Image Builder for Open Liberty Applications on OpenShift

This project contains a S2I builder image which creates an image running Java web applications on Open Liberty.

Source-to-Image (S2I) is a toolkit for building reproducible container images from source code. S2I produces ready-to-run images by injecting source code into a container image.

The Open Liberty builder can be used in two different environments:

  • OpenShift or MiniShift via 'oc new-app' and 'oc start-build'
  • Local Docker runtime via 's2i'


$ git clone
$ cd s2i-open-liberty
$ ROOT_FOLDER=$(pwd)

The following prerequisites are needed:

Run the sample application via S2I and Docker

$ cd ${ROOT_FOLDER}/sample
$ mvn package
$ s2i build . nheidloff/s2i-open-liberty authors
$ docker run -it --rm -p 9080:9080 authors
$ open http://localhost:9080/openapi/ui/

Structure of the web applications

To use "s2i" or "oc new-app/oc start-build" you need two files:

  • server.xml in the root directory
  • *.war file in the target directory

Run the sample application on Minishift

First the builder image needs to be built and deployed:

$ eval $(minishift docker-env)
$ oc login -u developer -p developer
$ oc new-project cloud-native-starter
$ docker login -u developer -p $(oc whoami -t) $(minishift openshift registry)
$ docker build -t nheidloff/s2i-open-liberty .
$ docker tag nheidloff/s2i-open-liberty:latest $(minishift openshift registry)/cloud-native-starter/s2i-open-liberty:latest
$ docker push $(minishift openshift registry)/cloud-native-starter/s2i-open-liberty

After the builder image has been deployed, Open Liberty applications can be deployed:

$ cd ${ROOT_FOLDER}/sample
$ mvn package
$ oc new-app s2i-open-liberty:latest~/. --name=authors
$ oc start-build --from-dir . authors 
$ oc expose svc/authors
$ open http://authors-cloud-native-starter.$(minishift ip)
$ curl -X GET "http://authors-cloud-native-starter.$(minishift ip)" -H "accept: application/json"
You can’t perform that action at this time.