Openshift

Using WildFly on Openshift

Openshift uses Image Streams to reference a Docker image. An image stream comprises one or more Docker images identified by tags. It presents a single virtual view of related images, similar to a Docker image repository, and may contain images from any of the following:

  1. Its own image repository in OpenShift’s integrated Docker Registry

  2. Other image streams

  3. Docker image repositories from external registries

The evident advantage of using Image Streams vs a standard Docker image is that OpenShift components such as builds and deployments can watch an image stream to receive notifications when new images are added and react by performing a build or a deployment. In other words, the Image Stream can let you decouple your application from a specific Docker Image.

Once started openshift, you should be able to find the available image streams with:

$ oc get is -n openshift
NAME         DOCKER REPO                            TAGS                         UPDATED
jenkins      172.30.1.1:5000/openshift/jenkins      latest,1,2                   6 minutes ago
mariadb      172.30.1.1:5000/openshift/mariadb      10.1,latest                  6 minutes ago
mongodb      172.30.1.1:5000/openshift/mongodb      latest,3.2,2.6 + 1 more...   6 minutes ago
mysql        172.30.1.1:5000/openshift/mysql        latest,5.6,5.5               6 minutes ago
nodejs       172.30.1.1:5000/openshift/nodejs       0.10,4,latest                6 minutes ago
perl         172.30.1.1:5000/openshift/perl         latest,5.20,5.16             6 minutes ago
php          172.30.1.1:5000/openshift/php          latest,5.6,5.5               6 minutes ago
postgresql   172.30.1.1:5000/openshift/postgresql   latest,9.5,9.4 + 1 more...   7 minutes ago
python       172.30.1.1:5000/openshift/python       3.4,3.3,2.7 + 2 more...      5 minutes ago
redis        172.30.1.1:5000/openshift/redis        latest,3.2                   3 minutes ago
ruby         172.30.1.1:5000/openshift/ruby         latest,2.3,2.2 + 1 more...   5 minutes ago
wildfly      172.30.1.1:5000/openshift/wildfly      10.1,10.0,9.0 + 2 more...    3 minutes ago

This is the default set of images you should be able to use when you start Openshift origin. What happens if for some reasons you are not able to see all the above image streams, for example in case you have accidentally deleted one of them ? That's not a big issue, perform the following actions:

Login in as administrator:

$ oc login -u system:admin

Now reload the Image streams from the following link: https://raw.githubusercontent.com/openshift/origin/master/examples/image-streams/image-streams-centos7.json

$ oc create -f https://raw.githubusercontent.com/openshift/origin/master/examples/image-streams/image-streams-centos7.json -n openshift

The image streans which are already loaded will be skipped. Now login as developer so that your WildFly application will be available in that namespace:

$ oc login 
Authentication required for https://192.168.1.194:8443 (openshift)
Username: developer
Password:  developer

Now you can test it loading a Git Hub project which uses WildFly Image Stream:

$ oc new-app wildfly~https://github.com/fmarchioni/ocpdemos --context-dir=wildfly-basic --name=wildfly-basic

Finally, expose the application wildfly-basic to the router so that it's available to outside:

$ oc expose service wildfly-basic

Follow us on Twitter