Skip to content

Commit

Permalink
Cleanup notes in Define a Command and Arguments docs
Browse files Browse the repository at this point in the history
  • Loading branch information
championshuttler committed Dec 22, 2021
1 parent 59f7c6f commit 7a2863b
Showing 1 changed file with 1 addition and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ If you define args, but do not define a command, the default command is used
with your new arguments.

{{< note >}}
The `command` field corresponds to `entrypoint` in some container
runtimes. Refer to the [Notes](#notes) below.
The `command` field corresponds to `entrypoint` in some container runtimes.
{{< /note >}}

In this exercise, you create a Pod that runs one container. The configuration
Expand Down Expand Up @@ -111,50 +110,9 @@ command: ["/bin/sh"]
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" %}}


* 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/).
* See [Container](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#container-v1-core).




2 comments on commit 7a2863b

@steren
Copy link

@steren steren commented on 7a2863b Feb 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the rationale behind this deletion? Why is it considered a "clean-up"? Do you have data that shows this was not useful to readers?

I have used this page and table multiple times to explain the behavior of Kubernetes command / args with Docker's ENTRYPOINT and CMD.

@libinglong
Copy link

@libinglong libinglong commented on 7a2863b Oct 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The table is useful to explain command and args with images. Also there is a stackoverflow question linked to this page! https://stackoverflow.com/questions/59248318/kubectl-run-command-vs-arguments#:~:text=If%20you%20supply%20a%20command,the%20args%20that%20you%20supplied.

Please sign in to comment.