Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

How to use odo the developer-centric CLI with OpenShift 4

 

October 16, 2019
Daniel Helfand
Related topics:
Developer ToolsKubernetes
Related products:
Red Hat OpenShift

Share:

    https://youtu.be/9QKTKjxgYsw 

    Working in a fast, iterative manner isn’t a practice exclusive to software developers: It’s the way people like to work. Being able to make a series of small changes and testing each change along the way to addressing a larger problem helps assure that the right choices are being made toward the end result.

    For developers working with OpenShift, the experience described above shouldn’t be any different. odo is a developer-centric CLI that helps developers implement, design and test source code with OpenShift faster. It’s one of a series of tools being released for general availability with the launch of OpenShift 4.2.

    With odo, the ability to work on local source code, make changes, and just as quickly push changes up to an OpenShift cluster is possible with this easy-to-use tool. If you’re familiar with git, the flow of using odo should be very familiar.

    By running a few CLI commands, you can push up local source code you are working on to OpenShift and have that source running on a container. Whenever you are ready to deploy code out to an OpenShift project, you can view several programming language options available with odo by running the command below:

    $ odo catalog list components
    
    odo Supported OpenShift Components:
    NAME       PROJECT     TAGS
    java       openshift   11,8,latest
    nodejs     openshift   10,8,8-RHOAR,latest
    
    
    
    OpenShift Components:
    
    NAME              PROJECT  TAGS
    dotnet            openshift 2.1,2.2,latest
    golang            openshift 1.11.5,latest
    httpd             openshift 2.4,latest
    modern-webapp     openshift 10.x,latest
    nginx             openshift 1.10,1.12,latest
    perl              openshift 5.24,5.26,latest
    php               openshift 7.0,7.1,7.2,latest
    python            openshift 2.7,3.6,latest
    ruby              openshift 2.4,2.5,latest

    These language options correspond to what are called builder images, which are container image definitions that can be used to support application source code developed in a particular language. In addition to selecting a language itself, you will be able to choose a particular version of a language as well.

    To select a language, in the root of the source code directory you are working in locally, you can run the following command

    $ odo create <language> app

    The odo create command specifies that you are creating a local configuration that will be used to track how you want your code to be deployed out to OpenShift. <language> in the above command corresponds to the programming language your application is written in.app corresponds to the name of the application that will be deployed. While you can give the application a specific name, it is not mandatory and you can deploy your code without specifying a name.

    If you were deploying a Node.js application using odo, the odo command you would run would be similar to what is shown below:

    $ odo create nodejs app

    After running odo create, all that is needed to deploy your code out to OpenShift is to run the following command:

    $ odo push

    odo create is similar to the idea of a git init where you are initializing that a local directory has source code written in a particular language. Editing the source code locally after running odo create is similar to a git commit. When you are committing to a change, you haven’t actually pushed that change remotely to be available in a git repository yet. odo follows this same flow that gives you control of when source code is actually deployed out to OpenShift.

    When odo push completes, your source code will be running on a container out in your OpenShift project. After an initial deployment via odo push, odo has the ability to quickly change and redeploy source code to your OpenShift cluster.

    To alter an application component after a first odo push, you can simply change your source code locally and run odo push again. Upon completion of the command, your changes should be running on OpenShift.

    While running an additional odo push is easy enough to push code changes, you can further simplify your redeployment using odo watch. By running odo watch in the directory you are working in, your code changes will automatically pushed up to OpenShift each time you make a local change without running
    odo push again.

    Another exciting feature that is currently in tech preview as part of the odo GA release is the ability to debug source code that is deployed on OpenShift. odo has a command called odo debug that allows you to remotely debug your code. The benefits of using a debugger locally are great, but odo allows you to have those same capabilities for code that is running in the environment it will eventually be hosted in. Keep an eye out for developments around odo debug as it reaches a more mature state in future releases.

    In addition to working with source code changes, odo allows you to manage other aspects of your deployed source code, such as creating a url for the application, linking your deployed application component to other application components deployed on OpenShift, viewing logs of deployed applications, and many other features. odo helps you focus on the source code you are writing for applications rather than all the details of hosting that application component on OpenShift.

    odo is one of the many tools being built at Red Hat that reflects the way developers like to work. Developing directly against a development environment and knowing that the code you are working on runs on OpenShift from the start of your work to the end is what odo was created for.

    In addition to this blog post, I have put together a video that walks through the capabilities of odo and shows how to deploy an application out to OpenShift. You can find out how to install, get started, and submit feedback on odo in the odo GitHub repository. We have an interactive tutorial available that allows users to learn more about odo and use it to deploy and iterate on a sample application with OpenShift. You can also view some of our past blog posts and videos on adding support for a programming language with odo (blog, video) and using interactive mode with odo.

    We are excited to see all the creative ways that developers use odo, and, more importantly, see all the things you create with it.

    Learn more about application development with OpenShift at developers.redhat.com/openshift.

    Last updated: June 27, 2023

    Recent Posts

    • More Essential AI tutorials for Node.js Developers

    • How to run a fraud detection AI model on RHEL CVMs

    • How we use software provenance at Red Hat

    • Alternatives to creating bootc images from scratch

    • How to update OpenStack Services on OpenShift

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue