OC(1)
πΈ OC(1) β the openshift CLI manual, but make it make sense π
okay bestie, so this is page one of the Openshift CLI User Manuals β the OC(1) one, from way back in June 2016 β¨ β and honestly? it's giving "main character energy" for anyone who wants to run an image on the cluster. let's get into it π«Ά
β¨ NAME β¨
oc run β run a particular image on the cluster π
β¨ SYNOPSIS β¨
oc run [OPTIONS]
β¨ DESCRIPTION β¨
Create and run a particular image in a pod. that's it. that's the whole vibe. π
β¨ OPTIONS β¨
--allow-missing-template-keys=trueβ iftrue, ignore any errors in templates when a field or map key is missing in the template. ngl this only applies togolangandjsonpathoutput formats, so don't come for me if you're using something else π--annotations=[]β annotations to apply to the pod. little sticky notes for your pod, love that πΈ--attach=falseβ iftrue, wait for the Pod to start running, and then attach to the Pod as if'kubectl attach ...'were called. defaultfalse, unless-i/--stdinis set, in which case the default istrue. and with'--restart=Never'the exit code of the container process is returned π«Ά--cascade="background"β must be"background","orphan", or"foreground". selects the deletion cascading strategy for the dependents (e.g. Pods created by a ReplicationController). defaults tobackgroundπ--command=falseβ iftrueand extra arguments are present, use them as the'command'field in the container, rather than the'args'field which is the default. iykyk π--dry-run="none"β must be"none","server", or"client". if client strategy, only print the object that would be sent, without sending it. if server strategy, submit server-side request without persisting the resource. manifesting your pod without actually creating it β¨--env=[]β environment variables to set in the container π--expose=falseβ iftrue, create a ClusterIP service associated with the pod. requires--portβ οΈ (yes, it really does, don't skip it)--field-manager="kubectl-run"β name of the manager used to track field ownership π·οΈ-f,--filename=[]β to use to replace the resource.--force=falseβ iftrue, immediately remove resources from API and bypass graceful deletion. > heads up bestie: immediate deletion of some resources may result in inconsistency or data loss and requires confirmation π this one's lowkey scary fr fr--grace-period=-1β period of time in seconds given to the resource to terminate gracefully. ignored if negative. set to1for immediate shutdown. can only be set to0when--forceis true (force deletion). give your pod a lil goodbye window π―οΈ--image=""β the image for the container to run. arguably the whole point πΌοΈ--image-pull-policy=""β the image pull policy for the container. if left empty, this value will not be specified by the client and defaulted by the server π€·ββοΈ-k,--kustomize=""β process a kustomization directory. this flag can't be used together with-for-R. pick a lane π-l,--labels=""β comma separated labels to apply to the pod. will override previous values. no cap, it replaces them π--leave-stdin-open=falseβ if the pod is started in interactive mode or with stdin, leave stdin open after the first attach completes. by default, stdin will be closed after the first attach completes πͺ-o,--output=""β output format. one of: (json,yaml,kyaml,name,go-template,go-template-file,template,templatefile,jsonpath,jsonpath-as-json,jsonpath-file). so many options, all iconic β--override-type="merge"β the method used to override the generated object:json,merge, orstrategicπ§--overrides=""β an inline JSON override for the generated object. if this is non-empty, it is used to override the generated object. requires that the object supply a validapiVersionfield π«‘--pod-running-timeout=0β the length of time (like5s,2m, or3h, higher than zero) to wait until at least one pod is running β³--port=""β the port that this container exposes π--privileged=falseβ iftrue, run the container in privileged mode. use responsibly, bestie π-q,--quiet=falseβ iftrue, suppress prompt messages. shhh π€«-R,--recursive=falseβ process the directory used in-f,--filenamerecursively. useful when you want to manage related manifests organized within the same directory ποΈ--restart="Always"β the restart policy for this Pod. legal values[Always, OnFailure, Never]π--rm=falseβ iftrue, delete the pod after it exits. only valid when attaching to the container, e.g. with'--attach'or with-i/--stdin'π§Ή--save-config=falseβ iftrue, the configuration of current object will be saved in its annotation. otherwise, the annotation will be unchanged. this flag is useful when you want to performkubectl applyon this object in the future π--show-managed-fields=falseβ iftrue, keep themanagedFieldswhen printing objects in JSON or YAML format π-i,--stdin=falseβ keep stdin open on the container in the pod, even if nothing is attached π«Ά--template=""β template string or path to template file to use when-o=go-template,-o=go-template-file. the template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview] π§--timeout=0β the length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object β°-t,--tty=falseβ allocate a TTY for the container in the pod π»--wait=falseβ iftrue, wait for resources to be gone before returning. this waits for finalizers π°οΈ
β¨ OPTIONS INHERITED FROM PARENT COMMANDS β¨
these are the ones you get handed down from the parent command, like a cute lil inheritance π
--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β iftrue, opt-out of response compression for all requests to the server π--insecure-skip-tls-verify=falseβ iftrue, the server's certificate will not be checked for validity. > this will make your HTTPS connections insecure π¬ like, actually insecure, bestie, be careful--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 β¨
like, just look at these, they ate π₯
# Start a nginx pod
oc run nginx --image=nginx
# Start a hazelcast pod and let the container expose port 5701
oc run hazelcast --image=hazelcast/hazelcast --port=5701
# Start a hazelcast pod and set environment variables "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default" in the container
oc run hazelcast --image=hazelcast/hazelcast --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
# Start a hazelcast pod and set labels "app=hazelcast" and "env=prod" in the container
oc run hazelcast --image=hazelcast/hazelcast --labels="app=hazelcast,env=prod"
# Dry run; print the corresponding API objects without creating them
oc run nginx --image=nginx --dry-run=client
# Start a nginx pod, but overload the spec with a partial set of values parsed from JSON
oc run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
# Start a busybox pod and keep it in the foreground, don't restart it if it exits
oc run -i -t busybox --image=busybox --restart=Never
# Start the nginx pod using the default command, but use custom arguments (arg1 .. argN) for that command
oc run nginx --image=nginx -- <arg1> <arg2> ... <argN>
# Start the nginx pod using a different command and custom arguments
oc run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>
β¨ SEE ALSO β¨
β¨ HISTORY β¨
June 2016, Ported from the Kubernetes man-doc generator π
that's the whole page, bestie β go run some pods and slay πβ¨π
signed off with love: Openshift β Openshift CLI User Manuals, page OC(1), dated June 2016 πππ¦
π¦ 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