@@ -162,11 +162,11 @@ You should avoid using the `:latest` tag when deploying containers in production
162
162
it is harder to track which version of the image is running and more difficult to
163
163
roll back properly.
164
164
165
- Instead, specify a meaningful tag such as `v1.42.0`.
165
+ Instead, specify a meaningful tag such as `v1.42.0` and/or a digest .
166
166
-->
167
167
在生产环境中部署容器时,你应该避免使用 ` :latest ` 标签,因为这使得正在运行的镜像的版本难以追踪,并且难以正确地回滚。
168
168
169
- 相反,应指定一个有意义的标签,如 ` v1.42.0 ` 。
169
+ 相反,应指定一个有意义的标签,如 ` v1.42.0 ` ,和/或者一个摘要 。
170
170
{{< /note >}}
171
171
172
172
<!--
@@ -204,11 +204,17 @@ running the same code no matter what tag changes happen at the registry.
204
204
205
205
When you (or a controller) submit a new Pod to the API server, your cluster sets the
206
206
`imagePullPolicy` field when specific conditions are met:
207
+
208
+ - if you omit the `imagePullPolicy` field, and you specify the digest for the
209
+ container image, the `imagePullPolicy` is automatically set to `IfNotPresent`.
207
210
-->
208
211
#### 默认镜像拉取策略 {#imagepullpolicy-defaulting}
209
212
210
213
当你(或控制器)向 API 服务器提交一个新的 Pod 时,你的集群会在满足特定条件时设置 ` imagePullPolicy ` 字段:
211
214
215
+ - 如果你省略了 ` imagePullPolicy ` 字段,并且你为容器镜像指定了摘要,
216
+ 那么 ` imagePullPolicy ` 会自动设置为 ` IfNotPresent ` 。
217
+
212
218
<!--
213
219
- if you omit the `imagePullPolicy` field, and the tag for the container image is
214
220
`:latest`, `imagePullPolicy` is automatically set to `Always`;
@@ -228,14 +234,15 @@ When you (or a controller) submit a new Pod to the API server, your cluster sets
228
234
{{< note >}}
229
235
<!--
230
236
The value of `imagePullPolicy` of the container is always set when the object is
231
- first _created_, and is not updated if the image's tag later changes.
237
+ first _created_, and is not updated if the image's tag or digest later changes.
232
238
233
239
For example, if you create a Deployment with an image whose tag is _not_
234
240
`:latest`, and later update that Deployment's image to a `:latest` tag, the
235
241
`imagePullPolicy` field will _not_ change to `Always`. You must manually change
236
242
the pull policy of any object after its initial creation.
237
243
-->
238
- 容器的 ` imagePullPolicy ` 的值总是在对象初次 _ 创建_ 时设置的,如果后来镜像的标签发生变化,则不会更新。
244
+ 容器的 ` imagePullPolicy ` 的值总是在对象初次 _ 创建_ 时设置的,
245
+ 如果后来镜像的标签或摘要发生变化,则不会更新。
239
246
240
247
例如,如果你用一个 ** 非** ` :latest ` 的镜像标签创建一个 Deployment,
241
248
并在随后更新该 Deployment 的镜像标签为 ` :latest ` ,则 ` imagePullPolicy ` 字段 ** 不会** 变成 ` Always ` 。
0 commit comments