table of contents
OC(1) | June 2016 | OC(1) |
NAME¶
oc new-app - Create a new application
SYNOPSIS¶
oc new-app [OPTIONS]
DESCRIPTION¶
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 look up the images on the local container storage (if available), a container image 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 or 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 oc 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.
OPTIONS¶
--allow-missing-images=false
If true, indicates that referenced container images that cannot be found
locally or in a registry should still be used.
--allow-missing-imagestream-tags=false
If true, indicates that image stream tags that don't exist should still be
used.
--allow-missing-template-keys=false
If true, ignore any errors in templates when a field or map key is missing in
the template. Only applies to golang and jsonpath output formats.
--as-deployment-config=false
If true create this application as a deployment config, which allows for
hooks and custom strategies.
--as-test=false
If true create this application as a test deployment, which validates that
the deployment succeeds and then scales down.
--binary=false
Instead of expecting a source URL, set the build to expect binary contents.
Will disable triggers.
--build-env=[]
Specify a key-value pair for an environment variable to set into each build
image.
--build-env-file=[]
File containing key-value pairs of environment variables to set into each
build image.
--code=[]
Source code to use to build this application.
--context-dir=""
Context directory to be used for the build.
--dry-run=false
If true, show the result of the operation without performing it.
-e, --env=[]
Specify a key-value pair for an environment variable to set into each
container.
--env-file=[]
File containing key-value pairs of environment variables to set into each
container.
-f, --file=[]
Path to a template file to use for the app.
--grant-install-rights=false
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.
--group=[]
Indicate components that should be grouped together as
<comp1>+<comp2>.
--ignore-unknown-parameters=false
If true, will not stop processing if a provided parameter does not exist in
the template.
--image=[]
Name of a container image to include in the app. Note: not specifying a
registry or repository means defaults in place for client image pulls are
employed.
-i, --image-stream=[]
Name of an existing image stream to use to deploy an app.
--import-mode=""
Imports the full manifest list of a tag when set to 'PreserveOriginal'.
Defaults to 'Legacy'.
--insecure-registry=false
If true, indicates that the referenced container 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.
--name=""
Set name to use for generated application artifacts
--no-install=false
Do not attempt to run images that describe themselves as being
installable
-o, --output=""
Output format. One of: (json, yaml, name, go-template, go-template-file,
template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file).
--output-version=""
The preferred API versions of the output objects
-p, --param=[]
Specify a key-value pair (e.g., -p FOO=BAR) to set/override a parameter value
in the template.
--param-file=[]
File containing parameter values to set/override in the template.
-S, --search=false
Search all templates, image streams, and container images that match the
arguments provided. Note: the container images search is run on the
OpenShift cluster via the ImageStreamImport API.
-a, --show-all=false
When printing, show all resources (default hide terminated pods.)
--show-labels=false
When printing, show all labels as the last column (default hide labels
column)
--show-managed-fields=false
If true, keep the managedFields when printing objects in JSON or YAML
format.
--sort-by=""
If non-empty, sort list types using this field specification. The field
specification is expressed as a JSONPath expression (e.g.
'{.metadata.name}'). The field in the API resource specified by this
JSONPath expression must be an integer or a string.
--source-secret=""
The name of an existing secret that should be used for cloning a private git
repository.
--strategy=
Specify the build strategy to use if you don't want to detect
(docker|pipeline|source). NOTICE: the pipeline strategy is deprecated;
consider using Jenkinsfiles directly on Jenkins or OpenShift Pipelines.
--template=[]
Name of a stored template to use in the app.
OPTIONS INHERITED FROM PARENT COMMANDS¶
--as=""
Username to impersonate for the operation. User could be a regular user or a
service account in a namespace.
--as-group=[]
Group to impersonate for the operation, this flag can be repeated to specify
multiple groups.
--as-uid=""
UID to impersonate for the operation.
--cache-dir="/home/abuild/.kube/cache"
Default cache directory
--certificate-authority=""
Path to a cert file for the certificate authority
--client-certificate=""
Path to a client certificate file for TLS
--client-key=""
Path to a client key file for TLS
--cluster=""
The name of the kubeconfig cluster to use
--context=""
The name of the kubeconfig context to use
--disable-compression=false
If true, opt-out of response compression for all requests to the server
--insecure-skip-tls-verify=false
If true, the server's certificate will not be checked for validity. This will
make your HTTPS connections insecure
--kubeconfig=""
Path to the kubeconfig file to use for CLI requests.
--match-server-version=false
Require server version to match client version
-n, --namespace=""
If present, the namespace scope for this CLI request
--profile="none"
Name of profile to capture. One of
(none|cpu|heap|goroutine|threadcreate|block|mutex)
--profile-output="profile.pprof"
Name of the file to write the profile to
--request-timeout="0"
The length of time to wait before giving up on a single server request.
Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h).
A value of zero means don't timeout requests.
-s, --server=""
The address and port of the Kubernetes API server
--tls-server-name=""
Server name to use for server certificate validation. If it is not provided,
the hostname used to contact the server is used
--token=""
Bearer token for authentication to the API server
--user=""
The name of the kubeconfig user to use
--warnings-as-errors=false
Treat warnings received from the server as errors and exit with a non-zero
exit code
EXAMPLE¶
# 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 container image
oc new-app . --image=registry/repo/langimage
# Create an application myapp with Docker based build strategy expecting binary input
oc new-app --strategy=docker --binary --name myapp
# Create a Ruby application based on the provided [image] [source code] combination
oc new-app centos/ruby-25-centos7 https://github.com/sclorg/ruby-ex.git
# Use the public container registry 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 --image=myregistry.com/mycompany/mysql --name=private
# Use an image with the full manifest list to create an app and override application artifacts' names
oc new-app --image=myregistry.com/mycompany/image --name=private --import-mode=PreserveOriginal
# 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 from a remote private repository and specify which existing secret to use
oc new-app https://github.com/youruser/yourgitrepo --source-secret=yoursecret
# 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 container images for the ones that match "ruby"
oc new-app --search ruby
# Search for "ruby", but only in stored templates (--template, --image-stream and --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 YAML
oc new-app --search --template=ruby --output=yaml
SEE ALSO¶
HISTORY¶
June 2016, Ported from the Kubernetes man-doc generator
Openshift CLI User Manuals | Openshift |