7.7. Executing remote commands in an OpenShift Container Platform container
You can use the oc exec command to execute remote commands in OpenShift Container Platform containers from your local machine.
7.7.1. Executing remote commands in containers 复制链接链接已复制到粘贴板!
You can use the OpenShift CLI (oc) to execute remote commands in OpenShift Container Platform containers. By running commands in a container, you can perform troubleshooting, inspect logs, run scripts, and other tasks.
Procedure
Use a command similar to the following to run a command in a container:
$ oc exec <pod> [-c <container>] -- <command> [<arg_1> ... <arg_n>]For example:
$ oc exec mypod dateExample output
Thu Apr 9 02:21:53 UTC 2015重要For security purposes, the
oc execcommand does not work when accessing privileged containers except when the command is executed by acluster-adminuser.