MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

Openshift: Lab 5 – Install an application from a source code using the oc CLI tool

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

StepActionCommand / UI
1Open Developer Sandbox web consoleBrowser
2Get CLI login command? icon → Command Line tools → Copy login command
3Display tokenClick Display Token
4Log in from terminalPaste copied oc login --token=... --server=...
5Deploy app from Git sourceoc new-app https://github.com/openshift/ruby-hello-world.git#beta4
6Track build logsoc logs -f buildconfig/ruby-hello-world
7Expose appoc expose service/ruby-hello-world
8Open appTopology view → URL/open icon
9Delete appoc 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

LabMethodToolExample
Lab 2Source code from GitHubWeb consolePython/Django source app
Lab 3Container imageWeb consoleParksMap image
Lab 4Container imageoc CLIGreeter image
Lab 5Source code from GitHuboc CLIRuby 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.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Top 10 Conversation Intelligence Platforms: Features, Pros, Cons & Comparison

Introduction Conversation Intelligence Platforms are advanced software solutions that capture, transcribe, analyze, and interpret conversations across voice calls, video meetings, and digital interactions. Using AI, natural language…

Read More

9 Best CRM for Manufacturing Companies That Sync with Your ERP

Picture this: your sales team just landed a marquee order, but the shop floor never got the memo. Raw-material bins sit empty, production slots are booked solid,…

Read More

List of Top Free Open Source & Self Hosted Application for Resource Planning

The three tools listed below are farmOS, grocy and Tania. All three are free, open source and self-hosted, and each one plans resources for a specific area:…

Read More

List of Top Free Open Source & Self Hosted Application for Software Development – Continuous Integration & Deployment

This page lists free, open source CI/CD servers you can host yourself, from long-established tools such as Jenkins, GitLab CI, GoCD and Buildbot to lighter, container-native options…

Read More

List of Top Free Open Source & Self Hosted Application for Knowledge Management Tools

This page lists free, open source knowledge management tools you can host on your own servers: Atomic Server for linked documents and data, and Mindmaps, My Mind…

Read More

List of Top Free Open Source & Self Hosted Application for Inventory Management

The best free, self-hosted inventory tool depends on what you track. InvenTree suits parts and stock control. Inventaire is a book-sharing catalogue. PartKeepr is an older tool…

Read More
Subscribe
Notify of
guest
2 Comments
Newest
Oldest Most Voted
Puja kushwaha
Puja kushwaha
1 month ago

Deploying source code with the oc CLI helps teams understand each step between a repository and a running application. Before starting, check repository access, build settings, and required environment variables. Watching build logs can reveal missing dependencies or configuration errors early. After deployment, verify the pod status, service route, and application logs instead of relying only on a successful build. Repeating this workflow with a small sample app builds useful troubleshooting skills for larger projects.

Skylar Bennett
Skylar Bennett
5 months ago

The tutorial covers source code deployment with the oc CLI 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.

2
0
Would love your thoughts, please comment.x
()
x