@@ -46,8 +46,7 @@ with your new arguments.
46
46
如果在配置文件中设置了容器启动时要执行的命令及其参数,那么容器镜像中自带的命令与参数将会被覆盖而不再执行。如果配置文件中只是设置了参数,却没有设置其对应的命令,那么容器镜像中自带的命令会使用该新参数作为其执行时的参数。
47
47
48
48
<!--
49
- The `command` field corresponds to `entrypoint` in some container
50
- runtimes. Refer to the [Notes](#notes) below.
49
+ The `command` field corresponds to `entrypoint` in some container runtimes.
51
50
-->
52
51
{{< note >}}
53
52
在有些容器运行时中,` command ` 字段对应 ` entrypoint ` ,请参阅下面的
@@ -161,73 +160,6 @@ command: ["/bin/sh"]
161
160
args: ["-c", "while true; do echo hello; sleep 10;done"]
162
161
` ` `
163
162
164
- <!--
165
- # # Notes
166
-
167
- This table summarizes the field names used by Docker and Kubernetes.
168
-
169
- | Description | Docker field name | Kubernetes field name |
170
- |----------------------------------------|------------------------|---------------------|
171
- | The command run by the container | Entrypoint | command |
172
- | The arguments passed to the command | Cmd | args |
173
- -->
174
- # # 说明事项 {#notes}
175
-
176
- 下表给出了 Docker 与 Kubernetes 中对应的字段名称。
177
-
178
- | 描述 | Docker 字段名称 | Kubernetes 字段名称 |
179
- |--------------------|--------------------|-----------------------|
180
- | 容器执行的命令 | Entrypoint | command |
181
- | 传给命令的参数 | Cmd | args |
182
-
183
- <!--
184
- When you override the default Entrypoint and Cmd, these rules apply :
185
-
186
- * If you do not supply `command` or `args` for a Container, the defaults defined
187
- in the Docker image are used.
188
-
189
- * If you supply a `command` but no `args` for a Container, only the supplied
190
- ` command` is used. The default EntryPoint and the default Cmd defined in the Docker
191
- image are ignored.
192
-
193
- * If you supply only `args` for a Container, the default Entrypoint defined in
194
- the Docker image is run with the `args` that you supplied.
195
-
196
- * If you supply a `command` and `args`, the default Entrypoint and the default
197
- Cmd defined in the Docker image are ignored. Your `command` is run with your
198
- ` args` .
199
- -->
200
- 如果要覆盖默认的 Entrypoint 与 Cmd,需要遵循如下规则:
201
-
202
- * 如果在容器配置中没有设置 `command` 或者 `args`,那么将使用 Docker 镜像自带的命令及其参数。
203
-
204
- * 如果在容器配置中只设置了 `command` 但是没有设置 `args`,那么容器启动时只会执行该命令,
205
- Docker 镜像中自带的命令及其参数会被忽略。
206
-
207
- * 如果在容器配置中只设置了 `args`,那么 Docker 镜像中自带的命令会使用该新参数作为其执行时的参数。
208
-
209
- * 如果在容器配置中同时设置了 `command` 与 `args`,那么 Docker 镜像中自带的命令及其参数会被忽略。
210
- 容器启动时只会执行配置中设置的命令,并使用配置中设置的参数作为命令的参数。
211
-
212
- <!--
213
- Here are some examples :
214
-
215
- | Image Entrypoint | Image Cmd | Container command | Container args | Command run |
216
- |--------------------|------------------|---------------------|--------------------|------------------|
217
- | `[/ep-1]` | `[foo bar]` | <not set> | <not set> | `[ep-1 foo bar]` |
218
- | `[/ep-1]` | `[foo bar]` | `[/ep-2]` | <not set> | `[ep-2]` |
219
- | `[/ep-1]` | `[foo bar]` | <not set> | `[zoo boo]` | `[ep-1 zoo boo]` |
220
- | `[/ep-1]` | `[foo bar]` | `[/ep-2]` | `[zoo boo]` | `[ep-2 zoo boo]` |
221
- -->
222
- 下面是一些例子:
223
-
224
- | 镜像 Entrypoint | 镜像 Cmd | 容器 command | 容器 args | 命令执行 |
225
- |--------------------|------------------|---------------------|--------------------|------------------|
226
- | `[/ep-1]` | `[foo bar]` | <not set> | <not set> | `[ep-1 foo bar]` |
227
- | `[/ep-1]` | `[foo bar]` | `[/ep-2]` | <not set> | `[ep-2]` |
228
- | `[/ep-1]` | `[foo bar]` | <not set> | `[zoo boo]` | `[ep-1 zoo boo]` |
229
- | `[/ep-1]` | `[foo bar]` | `[/ep-2]` | `[zoo boo]` | `[ep-2 zoo boo]` |
230
-
231
163
232
164
# # {{% heading "whatsnext" %}}
233
165
0 commit comments