Container Service: Developing an Application - Creating an Application - The oc new-app Command


The Container Service uses Red Hat's OpenShift to host containerized applications. The OpenShift command-line interface provides a quick command for creating working OpenShift applications based on existing Docker applications. This is: oc new-app

OpenShift Documentation: The new-app Command

This document provides examples of how to use the new-app command.

Create an App Based on a Hosted Dockerfile

You must have a Dockerfile in this repo for OpenShift to recognize it:
oc new-app --strategy=docker

  • Strategy option is only necessary if OpenShift cannot parse/recognize the repository's dockerfile.
    Note:OpenShift will read your Dockerfile most of the time, so the flag is most often unnecessary.


Specifying Branches or Tags

To specify a specific git branch or tag append #<name> to the git url. For example:

oc new-app --strategy=docker


Start a Build Based on a Local Directory that Contains a Dockerfile

oc start-build my-test-app --from-dir=.


Create an App in an Existing Project Based on a Dockerfile in a Local Directory

oc new-app --name=my-test-app .


Specifying a Base Layer with the new-app Command

This example uses a jboss build image, which overrides the 'FROM' command in the Dockerfile.
oc new-app jboss-eap64-openshift~


List all Base Images Available to the Current User

oc new-app -L


Create an App Based on Existing Image from the Red Hat Registry

oc new-app


Create an App Based on Existing Image from Docker Hub

oc new-app

Last Updated: 
Thursday, September 24, 2020