Merge pull request #31058 from championshuttler/notecleanup

Cleanup notes in Define a Command and Arguments docs
pull/31219/head
Kubernetes Prow Robot 2022-01-05 12:23:49 -08:00 committed by GitHub
commit 1b75c44306
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 43 deletions

View File

@ -36,8 +36,7 @@ If you define args, but do not define a command, the default command is used
with your new arguments. with your new arguments.
{{< note >}} {{< note >}}
The `command` field corresponds to `entrypoint` in some container The `command` field corresponds to `entrypoint` in some container runtimes.
runtimes. Refer to the [Notes](#notes) below.
{{< /note >}} {{< /note >}}
In this exercise, you create a Pod that runs one container. The configuration In this exercise, you create a Pod that runs one container. The configuration
@ -111,50 +110,9 @@ command: ["/bin/sh"]
args: ["-c", "while true; do echo hello; sleep 10;done"] args: ["-c", "while true; do echo hello; sleep 10;done"]
``` ```
## Notes
This table summarizes the field names used by Docker and Kubernetes.
| Description | Docker field name | Kubernetes field name |
|----------------------------------------|------------------------|-----------------------|
| The command run by the container | Entrypoint | command |
| The arguments passed to the command | Cmd | args |
When you override the default Entrypoint and Cmd, these rules apply:
* If you do not supply `command` or `args` for a Container, the defaults defined
in the Docker image are used.
* If you supply a `command` but no `args` for a Container, only the supplied
`command` is used. The default EntryPoint and the default Cmd defined in the Docker
image are ignored.
* If you supply only `args` for a Container, the default Entrypoint defined in
the Docker image is run with the `args` that you supplied.
* If you supply a `command` and `args`, the default Entrypoint and the default
Cmd defined in the Docker image are ignored. Your `command` is run with your
`args`.
Here are some examples:
| Image Entrypoint | Image Cmd | Container command | Container args | Command run |
|--------------------|------------------|---------------------|--------------------|------------------|
| `[/ep-1]` | `[foo bar]` | &lt;not set&gt; | &lt;not set&gt; | `[ep-1 foo bar]` |
| `[/ep-1]` | `[foo bar]` | `[/ep-2]` | &lt;not set&gt; | `[ep-2]` |
| `[/ep-1]` | `[foo bar]` | &lt;not set&gt; | `[zoo boo]` | `[ep-1 zoo boo]` |
| `[/ep-1]` | `[foo bar]` | `[/ep-2]` | `[zoo boo]` | `[ep-2 zoo boo]` |
## {{% heading "whatsnext" %}} ## {{% heading "whatsnext" %}}
* Learn more about [configuring pods and containers](/docs/tasks/). * Learn more about [configuring pods and containers](/docs/tasks/).
* Learn more about [running commands in a container](/docs/tasks/debug-application-cluster/get-shell-running-container/). * Learn more about [running commands in a container](/docs/tasks/debug-application-cluster/get-shell-running-container/).
* See [Container](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#container-v1-core). * See [Container](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#container-v1-core).