OC(1)
π NAME π
hii bestie π welcome to oc(1) β specifically the page for oc new-app, dated June 2016 in the header. The name-line tea is:
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. Periodt.
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. Itβs giving βlet me check every drawer real quickβ energy ππ
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. Autodetect is lowkey the main character here π
If you provide source code, a new build will be automatically triggered. You can use 'oc status' to check the progress. fr fr, go check on it πΈ
π OPTIONS π
--allow-missing-images=falseβ if this istrue, it means referenced container images that cannot be found locally or in a registry should still be used. π«Ά--allow-missing-imagestream-tags=falseβ if this istrue, it means image stream tags that don't exist should still be used. β¨--allow-missing-template-keys=falseβ if this istrue, ignore any errors in templates when a field or map key is missing in the template. Only applies togolangandjsonpathoutput formats.--as-deployment-config=falseβ if this istrue, create this application as a deployment config, which allows for hooks and custom strategies. π--as-test=falseβ if this istrue, 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. This 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 this istrue, 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 this istrue, 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 this istrue, it 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 this istrue, it means 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,kyaml,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 theImageStreamImportAPI.-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 this istrue, keep themanagedFieldswhen 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. this one is important, bestie π--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.--as-user-extra=[]β user extras to impersonate for the operation; this flag can be repeated to specify multiple values for the same key.--cache-dir="/homeless-shelter/.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 this istrue, opt-out of response compression for all requests to the server.--insecure-skip-tls-verify=falseβ if this istrue, 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.--kuberc=""β path to the kuberc file to use for preferences. This can be disabled by exportingKUBECTL_KUBERC=falsefeature gate or turning off the featureKUBERC=off.--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 πΈ
ok so this is the part everyone actually came for β the receipts π every single one of these is copy-pasteable, so go off bestie:
# 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
ok lowkey yes there are two spaces after new-app in that last one β that's literally how it's written, don't come for me π
# 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?? told you β¨ every flag, every path, every MYSQL_USER=admin, all of it, untouched. no cap π«Ά
π SEE ALSO π
yeah it's just the one (1) reference and yes it keeps its lil trailing comma, that's how we roll π
π¦ HISTORY π¦
June 2016, Ported from the Kubernetes man-doc generator
a vintage. an icon. June 2016 really said "let me port this from the Kubernetes man-doc generator" and we've been eating ever since ππ
and that's the whole page bestie!! πβ¨
this lil masterpiece comes to you courtesy of Openshift β living under the Openshift CLI User Manuals umbrella, dated way back in June 2016, page name OC(1) and all π
go create an app or twelve, you absolute main character π§π
π¦ where this page comes from
- nixpkgs unstable: openshift 4.22.0-202605222050
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms