Overview
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 https://github.com/chriskretler/openshift-python-sample --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 https://github.com/chriskretler/openshift-python-sample#mybranch --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~https://github.com/dnowell/openshift3mlbparks.git
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 registry.access.redhat.com/ubi8/ubi:latest
Create an App Based on Existing Image from Docker Hub
oc new-app docker.io/redis:latest