This is a cache of https://docs.openshift.com/container-platform/3.5/cli_reference/basic_cli_operations.html. It is a snapshot of the page at 2024-11-23T03:56:30.872+0000.
Developer <strong>cli</strong> Operations | <strong>cli</strong> Reference | OpenShift Container Platform 3.5
×

Overview

This topic provides information on the developer cli operations and their syntax. You must setup and login with the cli before you can perform these operations.

The developer cli uses the oc command, and is used for project-level operations. This differs from the administrator cli, which uses the oc adm command for more advanced, administrator operations.

Common Operations

The developer cli allows interaction with the various objects that are managed by OpenShift Container Platform. Many common oc operations are invoked using the following syntax:

$ oc <action> <object_type> <object_name>

This specifies:

  • An <action> to perform, such as get or describe.

  • The <object_type> to perform the action on, such as service or the abbreviated svc.

  • The <object_name> of the specified <object_type>.

For example, the oc get operation returns a complete list of services that are currently defined:

$ oc get svc
NAME              LABELS                                    SELECTOR                  IP              PORT(S)
docker-registry   docker-registry=default                   docker-registry=default   172.30.78.158   5000/TCP
kubernetes        component=apiserver,provider=kubernetes   <none>                    172.30.0.2      443/TCP
kubernetes-ro     component=apiserver,provider=kubernetes   <none>                    172.30.0.1      80/TCP

The oc describe operation can then be used to return detailed information about a specific object:

$ oc describe svc docker-registry
Name:			docker-registry
Labels:			docker-registry=default
Selector:		docker-registry=default
IP:			172.30.78.158
Port:			<unnamed>	5000/TCP
Endpoints:		10.128.0.2:5000
Session Affinity:	None
No events.

Versions of oc prior to 3.0.2.0 did not have the ability to negotiate API versions against a server. So if you are using oc up to