OpenShift Enterprise 3.0 – basic CLI commands


oc whoami Examine user session
oc login -u username -p p@ssword log in as a different user
oc new-project MY-NEW-PROJECT –display-name=”My New  Example Project” –description=”A new project
Create a project to contain applications
oc project Confirmation that the project was successfully created and verify how many project do you have
oc get all Confirm there are no objects in your project
oc project MY-NEW-PROJECT use the MY-NEW-PROJECT project


oc new-app –name=’my-ruby-hello-world’ –labels=”environment=dev” Create an application from a remote repository
oc statusStatus of deployment
oc get allExamine all of the major objects in project
oc describe buildconfig my-ruby-hello-world Examine the project’s build configuration
oc describe build my-ruby-hello-world-1
Examine the build object
oc describe imagestream my-ruby-hello-world
Examine the image streams
oc describe deploymentconfig my-ruby-hello-world
Examine the deployment configuration, which manages the creation of replication controllers and pods
oc describe replicationcontroller my-ruby-hello-world-1Examine the replication controller, which sets and maintains how many pods are to be deployed
oc describe svc my-ruby-hello-world

Examine the service, which directs access to all of the pods from a single IP address
oc logs my-ruby-hello-world-1-build

Examine the logs of the builder pod


oc expose svc my-ruby-hello-world
Enable web access to application
oc get route
Find the route
oc describe route my-ruby-hello-world
Describe the route


oc get pods Determine the number of pods you have in the ruby-hello-world project (namespace)
oc scale –replicas=3 deploymentconfig my-ruby-hello-world Scale up the number of pods to 3
oc describe replicationcontroller my-ruby-hello-world-1 Describe the replication controller
oc get pods -o wide Determine which nodes have which pods
oc describe svc my-ruby-hello-world Examine the service


oc new-project
Create a project to contain applications
git clone<yourname>/ruby-hello-world
Clone this repository
cd ruby-hello-world/
Change to the ruby-hello-world directory
oc new-app . –
Create an application in the local repository
oc logs -f ruby-hello-world-1-build
View the build log