1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 21:46:22 +01:00
Files
openshift-docs/modules/cli-developer-troubleshooting.adoc
2019-11-21 15:38:31 +00:00

114 lines
2.5 KiB
Plaintext

// Module included in the following assemblies:
//
// * cli_reference/openshift_cli/developer-cli-commands.adoc
[id="cli-troubleshooting-commands_{context}"]
= Troubleshooting and debugging CLI commands
== attach
Attach the shell to a running container.
.Example: Get output from the `python` container from Pod `python-1-mz2rf`
----
$ oc attach python-1-mz2rf -c python
----
== cp
Copy files and directories to and from containers.
.Example: Copy a file from the `python-1-mz2rf` Pod to the local file system
----
$ oc cp default/python-1-mz2rf:/opt/app-root/src/README.md ~/mydirectory/.
----
== debug
Launch a command shell to debug a running application.
.Example: Debug the `python` Deployment
----
$ oc debug deploymentconfig/python
----
== exec
Execute a command in a container.
.Example: Execute the `ls` command in the `python` container from Pod `python-1-mz2rf`
----
$ oc exec python-1-mz2rf -c python ls
----
== logs
Retrieve the log output for a specific build, BuildConfig, DeploymentConfig, or
Pod.
.Example: Stream the latest logs from the `python` DeploymentConfig
----
$ oc logs -f deploymentconfig/python
----
== port-forward
Forward one or more local ports to a Pod.
.Example: Listen on port `8888` locally and forward to port `5000` in the Pod
----
$ oc port-forward python-1-mz2rf 8888:5000
----
== proxy
Run a proxy to the Kubernetes API server.
.Example: Run a proxy to the API server on port `8011` serving static content from `./local/www/`
----
$ oc proxy --port=8011 --www=./local/www/
----
== rsh
Open a remote shell session to a container.
.Example: Open a shell session on the first container in the `python-1-mz2rf` Pod
----
$ oc rsh python-1-mz2rf
----
== rsync
Copy contents of a directory to or from a running Pod container. Only changed
files are copied using the `rsync` command from your operating system.
.Example: Synchronize files from a local directory with a Pod directory
----
$ oc rsync ~/mydirectory/ python-1-mz2rf:/opt/app-root/src/
----
== run
Create and run a particular image. By default, this creates a DeploymentConfig
to manage the created containers.
.Example: Start an instance of the `perl` image with three replicas
----
$ oc run my-test --image=perl --replicas=3
----
== wait
Wait for a specific condition on one or more resources.
[NOTE]
====
This command is experimental and might change without notice.
====
.Example: Wait for the `python-1-mz2rf` Pod to be deleted
----
$ oc wait --for=delete pod/python-1-mz2rf
----