IBM/minishift101 - step 2 - creating an app from source
After creating a project as instructed in the previous lab (Step 1), the next step is to create an OpenShift application in the cluster.
1. Creating an app
There are several ways in which you can create an app in OpenShift:
From source code
From DockerHub images
From OpenShift templates
From the OpenShift UI
1.1 Creating an app from source
With oc new-app
command, you can create an application in OpenShift from some existing source code either locally or with the url to the repository. If a source repository is specified, new-app
will check to see which build strategy to use (Docker or Source).
With the former, a runnable image is created, whereas as the latter, new-app
will try to identify the language by looking at the files in the project's root directory and then use an appropriate builder.
To build from a local Dockerfile:
To build from source:
1.2 Creating an app from a DockerHub image
Similar to Docker, OpenShift is also configured to the public image registry DockerHub. If you specify an image that exists in DockerHub, the new-app
command will create a runnable image directly from this image.
For example, if you wanted to create an app from the official nginx image, you would run:
You are not limited to the DockerHub registry, however - as with Docker, you are able to specify images that are stored in private registries too:
1.3 Creating an app from an OpenShift template
OpenShift templates are basically starter applications that have been configured ready for OpenShift. These cover frequently used applications deployed in containers e.g. Ruby, Node and MongoDB.
To deploy it, you can run:
1.4 Creating an app from the OpenShift UI
Login to the UI:
As mentioned in the minishift start
output, you can use the user developer and password as any string of characters (at least one) and you will be able to access the UI.
Access the catalog:
Last updated
Was this helpful?