Over a million developers have joined DZone.

OpenShift Quick Start: CLI

DZone's Guide to

OpenShift Quick Start: CLI

This OpenShift tutorial series continues with how to use the CLI over the command line interface, along with useful console commands.

· Microservices Zone ·
Free Resource

Record growth in microservices is disrupting the operational landscape. Read the Global Microservices Trends report to learn more.

This post is a continuation of our hands-on OpenShift Quick Start blog series. In the first post, we introduced OpenShift, and in part two, you worked to get OpenShift running locally & adding a Container with an API service to a Pod. Make sure you've completed that step prior to starting the continued exercise below!

The previous blogs in this series managed OpenShift using the web admin user interface. However, everything that can be done with the user interface can also be done from using the CLI (Command Line Interface). Arguably, developers prefer to interact with text commands, but that's a generalization.

In this post, we'll demonstrate common OpenShift commands can be done in the web admin from the command line.

Here are the reasons the CLI might be used over the command line interface.

  • Integrating with programming languages
  • Scripting
  • When bandwidth is constrained

The CLI is used to start up the cluster, which you should have completed in the previous blog as shown below.

oc cluster up

Available CLI commands are displayed using the help option:

oc help

Available help commands will be displayed:

You can obtain the status of your cluster:

oc cluster up

Other Example Commands

Here are a couple more example commands.

Cluster projects

$ oc project

Deploy container image to a Pod

     $ oc deploy example-api -n myproject

Scaling up a Pod to 3 replicas

    $ oc scale --replicas dc example-api

There are many commands. Essentially, you can do everything you can do in the web admin from the command line.

The next blog in this OpenShift series will walk through the Continuous Integration / Continuous Delivery (CICD) building and Jenkins 2 Pipeline integration. Stay tuned!


  1. Introduction to Managing Docker Containers with OpenShift and Kubernetes
  2. OpenShift Quick Start - Installing OpenShift locally & adding a Container with an API service to a Pod
  3. This Post -> Scaling Pods and Managing Cluster with the Command Line Interface
  4. Continuous Build and Deploy with Jenkins 2 Pipelines
  5. Using an STI (Source to Image) Utility to Create and Deploy Spring Boot Java Image

Learn why microservices are breaking traditional APM tools that were built for monoliths.

openshift ,cli ,microservices ,tutorial

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}