docker login
Navigate to project folder and create Dockerfile to run the app. Here are the relevant Docker docs:
# Docker Docs: https://docs.docker.com/
# Docker Reference: https://docs.docker.com/reference/
For this workshop, we will use the following repository that has an example Dockerfile. MAX Object Detector is an :
https://github.com/IBM/MAX-Object-Detector
Use the steps below to get access to a Red Hat OpenShift cluster.
NOTE: Cluster Allocations are limited by time on Open Labs. Please make sure to complete the labs as soon as possible Clusters will shut down approximately 3 to 4hrs after spinning up
- Navigate to:
https://developer.ibm.com/openlabs/openshift
-
You will be asked to sign in with your IBM account.
- Sign up for a IBM Cloud Account if you don't already have one Sign up here
- Sign in to your temporary RHOS cluster
-
Once you are in the lab, login to Openshift Cluster in the CLI.
oc login --server https://c100-e.us-east.containers.cloud.ibm.com:32581 -u apikey -p ${API_KEY}
This command will be availble under the
Quick Links and Common Commands
tab: -
Let's deploy the app. All you have to do is create new app in the project and Openshift will handle the rest:
oc new-app https://github.com/IBM/MAX-Object-Detector
TLDR: Using the new-app results in a build configuration, which creates a new application image from your source code. It also constructs a deployment configuration to deploy the new image, and a service to provide load-balanced access to the deployment running your image. Notice that we didn't even specify the build strategy? OpenShift automatically detects whether the Docker or Source build strategy is being used, and in the case of Source builds, detects an appropriate language builder image.
-
Since this is a web application that will reach end users we need a route to expose this app. An OpenShift Container Platform
route
exposes a service at a secure host name, likewww.example.com
, so that external clients can reach it by name. To do this we simply run:oc expose svc/max-object-detector
-
Now to access the route where our app is hosted we will run the get routes command:
oc get routes
In this example the route url would be
http://max-object-detector-default.dte-ocp46-kcwjv9-915b3b336cabec458a7c7ec2aa7c625f-0000.us-east.containers.appdomain.cloud
-
Navigate to the route and Oila! Your github repo's code was put into an image that is pushed into your own private Openshift Image Registry and is now a running app on Openshift. Launch the app and have fun exploring: