Lab 5 summary
This lab teaches how to use the oc CLI from your local machine to deploy an application into OpenShift Developer Sandbox from source code stored in GitHub. OpenShift uses oc new-app to detect the source, select/create the builder workflow, build a container image, create the app resources, and then you expose it with a Route.
Sample application used
https://github.com/openshift/ruby-hello-world.git#beta4
Code language: JavaScript (javascript)
Main command from the lab:
oc new-app https://github.com/openshift/ruby-hello-world.git#beta4
Code language: JavaScript (javascript)
The expected created resources include:
imagestream.image.openshift.io "ruby-22-centos7" created
imagestream.image.openshift.io "ruby-hello-world" created
buildconfig.build.openshift.io "ruby-hello-world" created
deployment.apps "ruby-hello-world" created
service "ruby-hello-world" created
Code language: CSS (css)
The lab then tells you to expose the service:
oc expose service/ruby-hello-world
Expected output:
route.route.openshift.io/ruby-hello-world exposed
Main flow
| Step | Action | Command / UI |
|---|---|---|
| 1 | Open Developer Sandbox web console | Browser |
| 2 | Get CLI login command | ? icon → Command Line tools → Copy login command |
| 3 | Display token | Click Display Token |
| 4 | Log in from terminal | Paste copied oc login --token=... --server=... |
| 5 | Deploy app from Git source | oc new-app https://github.com/openshift/ruby-hello-world.git#beta4 |
| 6 | Track build logs | oc logs -f buildconfig/ruby-hello-world |
| 7 | Expose app | oc expose service/ruby-hello-world |
| 8 | Open app | Topology view → URL/open icon |
| 9 | Delete app | oc delete all -l app=ruby-hello-world |
Clean CLI version of Lab 5
# Log in using the token command copied from OpenShift web console
oc login --token=<your-token> --server=<your-api-server>
# Confirm login
oc whoami
# Check current project
oc project
# Deploy app from GitHub source code
oc new-app https://github.com/openshift/ruby-hello-world.git#beta4
# Watch the build logs
oc logs -f buildconfig/ruby-hello-world
# Check created resources
oc get all
# Expose the service as a route
oc expose service/ruby-hello-world
# Get route
oc get route ruby-hello-world
# Test the route
curl -I http://$(oc get route ruby-hello-world -o jsonpath='{.spec.host}')
# Delete application resources
oc delete all -l app=ruby-hello-world
Code language: PHP (php)
Important correction
The PDF text says the selector option is -1, but that is a typo. The actual oc selector flag is lowercase -l, meaning “label selector.”
Correct:
oc delete all -l app=ruby-hello-world
Code language: JavaScript (javascript)
Incorrect:
oc delete all -1 app=ruby-hello-world
Code language: JavaScript (javascript)
The command shown in the PDF is correct, but the explanatory sentence has the typo.
Difference from earlier labs
| Lab | Method | Tool | Example |
|---|---|---|---|
| Lab 2 | Source code from GitHub | Web console | Python/Django source app |
| Lab 3 | Container image | Web console | ParksMap image |
| Lab 4 | Container image | oc CLI | Greeter image |
| Lab 5 | Source code from GitHub | oc CLI | Ruby hello-world source app |
So yes: Lab 5 is basically the CLI version of Lab 2, while Lab 4 was the CLI version of Lab 3.
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at Cotocus. I share tech blog at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow , and SEO strategies at Wizbrand.
Do you want to learn Quantum Computing?
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at WIZBRAND
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals
The tutorial covers source code deployment with the
ocCLI effectively, but it would be helpful to include some considerations for maintaining these workflows at scale. In production environments, teams often focus on reducing build times through dependency caching, implementing vulnerability scans for generated images, and establishing clear artifact promotion processes. Discussing how these deployments fit into GitOps-based delivery models would also provide readers with a better understanding of managing consistent releases across multiple environments.