oc-new-app man page

oc new-app — Create a new application


oc new-app [Options]


Create a new application by specifying source code, templates, and/or images

This command will try to build up the components of an application using images, templates, or code that has a public repository. It will lookup the images on the local Docker installation (if available), a Docker registry, an integrated image stream, or stored templates.

If you specify a source code URL, it will set up a build that takes your source code and converts it into an image that can run inside of a pod. Local source must be in a git repository that has a remote repository that the server can see. The images will be deployed via a deployment configuration, and a service will be connected to the first public port of the app. You may either specify components using the various existing flags or let new-app autodetect what kind of components you have provided.

If you provide source code, a new build will be automatically triggered. You can use 'oc status' to check the progress.


If true, indicates that referenced Docker images that cannot be found locally or in a registry should still be used.
If true, indicates that image stream tags that don't exist should still be used.
If true create this application as a test deployment, which validates that the deployment succeeds and then scales down.
Source code to use to build this application.
Context directory to be used for the build.
Name of a Docker image to include in the app.
If true, show the result of the operation without performing it.
-e, --env=[]
Specify key-value pairs of environment variables to set into each container. This doesn't apply to objects created from a template, use parameters instead.
-f, --file=[]
Path to a template file to use for the app.
If true, a component that requires access to your account may use your token to install software into your project. Only grant images you trust the right to run with your token.
Indicate components that should be grouped together as <comp1>+<comp2>.
Name of an image stream to use in the app. (deprecated)
-i, --image-stream=[]
Name of an image stream to use in the app.
If true, indicates that the referenced Docker images are on insecure registries and should bypass certificate checking
-l, --labels=""
Label to set in all resources for this application.
-L, --list=false
List all local templates and image streams that can be used to create.
Set name to use for generated application artifacts
Do not attempt to run images that describe themselves as being installable
-o, --output=""
Output results as yaml or json instead of executing, or use name for succint output (resource/name).
The preferred API versions of the output objects
-p, --param=[]
Specify a list of key value pairs (e.g., -p FOO=BAR,BAR=FOO) to set/override parameter values in the template.
-S, --search=false
Search all templates, image streams, and Docker images that match the arguments provided.
Specify the build strategy to use if you don't want to detect (docker|source).
Name of a stored template to use in the app.

Options Inherited from Parent Commands

DEPRECATED: The API version to use when talking to the server

Username to impersonate for the operation.

Path to a cert. file for the certificate authority.

Path to a client certificate file for TLS.

Path to a client key file for TLS.

The name of the kubeconfig cluster to use

Path to the config file to use for CLI requests.

The name of the kubeconfig context to use

The Google Cloud Platform Service Account JSON Key to use for authentication.

If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure.

Maximum number of seconds between log flushes

Require server version to match client version

-n, --namespace=""
If present, the namespace scope for this CLI request.

The address and port of the Kubernetes API server

Bearer token for authentication to the API server.

The name of the kubeconfig user to use


# List all local templates and image streams that can be used to create an app
oc new-app --list

# Create an application based on the source code in the current git repository (with a public remote)
# and a Docker image
oc new-app . --docker-image=repo/langimage

# Create a Ruby application based on the provided [image] [source code] combination
oc new-app centos/ruby-22-centos7 https://github.com/openshift/ruby-ex.git

# Use the public Docker Hub MySQL image to create an app. Generated artifacts will be labeled with db=mysql
oc new-app mysql MYSQL_USER=user MYSQL_PASSWORD=pass MYSQL_DATABASE=testdb -l db=mysql

# Use a MySQL image in a private registry to create an app and override application artifacts' names
oc new-app --docker-image=myregistry.com/mycompany/mysql --name=private

# Create an application from a remote repository using its beta4 branch
oc new-app https://github.com/openshift/ruby-hello-world#beta4

# Create an application based on a stored template, explicitly setting a parameter value
oc new-app --template=ruby-helloworld-sample --param=MYSQL_USER=admin

# Create an application from a remote repository and specify a context directory
oc new-app https://github.com/youruser/yourgitrepo --context-dir=src/build

# Create an application based on a template file, explicitly setting a parameter value
oc new-app --file=./example/myapp/template.json --param=MYSQL_USER=admin

# Search all templates, image streams, and Docker images for the ones that match "ruby"
oc new-app --search ruby

# Search for "ruby", but only in stored templates (--template, --image-stream and --docker-image
# can be used to filter search results)
oc new-app --search --template=ruby

# Search for "ruby" in stored templates and print the output as an YAML
oc new-app --search --template=ruby --output=yaml

See Also



June 2016, Ported from the Kubernetes man-doc generator

Referenced By


Explore man page connections for oc-new-app(1).

Openshift Openshift CLI User Manuals June 2016