Review the following sections to learn how to complete common tasks using the CLI.
Use the oc new-project
command to create a new project.
$ oc new-project my-project Now using project "my-project" on server "https://openshift.example.com:6443".
Use the oc new-app
command to create a new application.
$ oc new-app https://github.com/sclorg/cakephp-ex --> Found image 40de956 (9 days old) in imagestream "openshift/php" under tag "7.2" for "php" ... Run 'oc status' to view your app.
Use the oc get pods
command to view the pods for the current project.
$ oc get pods -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE cakephp-ex-1-build 0/1 Completed 0 5m45s 10.131.0.10 ip-10-0-141-74.ec2.internal <none> cakephp-ex-1-deploy 0/1 Completed 0 3m44s 10.129.2.9 ip-10-0-147-65.ec2.internal <none> cakephp-ex-1-ktz97 1/1 Running 0 3m33s 10.128.2.11 ip-10-0-168-105.ec2.internal <none>
Use the oc logs
command to view logs for a particular pod.
$ oc logs cakephp-ex-1-deploy --> Scaling cakephp-ex-1 to 1 --> Success
Use the oc project
command to view the current project.
$ oc project Using project "my-project" on server "https://openshift.example.com:6443".
Use the oc status
command to view information about the current project, such
as Services, DeploymentConfigs, and BuildConfigs.
$ oc status In project my-project on server https://openshift.example.com:6443 svc/cakephp-ex - 172.30.236.80 ports 8080, 8443 dc/cakephp-ex deploys istag/cakephp-ex:latest <- bc/cakephp-ex source builds https://github.com/sclorg/cakephp-ex on openshift/php:7.2 deployment #1 deployed 2 minutes ago - 1 pod 3 infos identified, use 'oc status --suggest' to see details.