OpenShift - Deploy an application from a build

An image contains the code used to create a deployment. Then, a deployment can be created from an image, which should then create a replica set (which is the number of pods that should be created), and then the pods should be created.

There are various ways to deploy an app.

Before importing an image, the oc get images command can be used to determine if the image has already been imported.

~]# oc get images
NAME                                                                      IAMGE REFERENCE


The oc new-build command can be used to import an image from an external registry, such as GitHub. In this example, an image named camel-app is imported.

~]$ oc new-build fabric8/s2i-java~ --name=camel-app
--> Found container image ec41b73 (20 months old) from Docker Hub for "fabric8/s2i-java"

    Java Applications 
    Platform for building and running plain Java applications (fat-jar and flat classpath)

    Tags: builder, java

    * An image stream tag will be created as "s2i-java:latest" that will track the source image
    * A source build using source code from will be created
      * The resulting image will be pushed to image stream tag "my-demo-app:latest"
      * Every time "s2i-java:latest" changes a new build will be triggered

--> Creating resources with label build=camel-app ... "s2i-java" created "camel-app" created "camel-app" created
--> Success


The oc get builds command can then be used to determine if the build is running.

~]$ oc get builds
NAME               TYPE     FROM   STATUS                       STARTED         DURATION
camel-app-1        Source   Git    Running                      2 minutes ago


And the oc get imagestreams command should return something like this.

~]$ oc get is | grep -i demo
camel-app                                    image-registry.openshift-image-registry.svc:5000/foo/camel-app



Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 1b444 in the box below so that we can be sure you are a human.