@@ -17,11 +17,12 @@ This page shows how to create a Pod that uses a
17
17
{{< glossary_tooltip text="Secret" term_id="secret" >}} to pull an image
18
18
from a private container image registry or repository. There are many private
19
19
registries in use. This task uses [Docker Hub](https://www.docker.com/products/docker-hub)
20
+ as an example registry.
20
21
-->
21
22
本文介绍如何使用 {{< glossary_tooltip text="Secret" term_id="secret" >}}
22
23
从私有的镜像仓库或代码仓库拉取镜像来创建 Pod。
23
24
有很多私有镜像仓库正在使用中。这个任务使用的镜像仓库是
24
- [ Docker Hub] ( https://www.docker.com/products/docker-hub )
25
+ [ Docker Hub] ( https://www.docker.com/products/docker-hub ) 。
25
26
26
27
{{% thirdparty-content single="true" %}}
27
28
@@ -45,12 +46,20 @@ registries in use. This task uses [Docker Hub](https://www.docker.com/products/d
45
46
<!--
46
47
## Log in to Docker
47
48
48
- On your laptop, you must authenticate with a registry in order to pull a private image:
49
+ On your laptop, you must authenticate with a registry in order to pull a private image.
49
50
-->
50
51
## 登录 Docker 镜像仓库 {#log-in-to-docker}
51
52
52
53
在个人电脑上,要想拉取私有镜像必须在镜像仓库上进行身份验证。
53
54
55
+ <!--
56
+ Use the `docker` tool to log in to Docker Hub. See the _log in_ section of
57
+ [Docker ID accounts](https://docs.docker.com/docker-id/#log-in) for more information.
58
+ -->
59
+ 使用 ` docker ` 命令工具来登录到 Docker Hub。
60
+ 更多详细信息,请查阅
61
+ [ Docker ID accounts] ( https://docs.docker.com/docker-id/#log-in ) 中的 _ log in_ 部分。
62
+
54
63
``` shell
55
64
docker login
56
65
```
@@ -161,7 +170,8 @@ the base64 encoded string in the data was successfully decoded, but could not be
161
170
如果你收到错误消息:`error : no objects passed to create`,
162
171
这可能意味着 base64 编码的字符串是无效的。 如果你收到类似
163
172
`Secret "myregistrykey" is invalid : data[.dockerconfigjson]: invalid value ...`
164
- 的错误消息,则表示数据中的 base64 编码字符串已成功解码,但无法解析为 `.docker/config.json` 文件。
173
+ 的错误消息,则表示数据中的 base64 编码字符串已成功解码,
174
+ 但无法解析为 `.docker/config.json` 文件。
165
175
166
176
<!--
167
177
# # Create a Secret by providing credentials on the command line
@@ -227,7 +237,9 @@ To understand the contents of the `regcred` Secret you created, start by viewing
227
237
kubectl get secret regcred --output=yaml
228
238
` ` `
229
239
230
- <!-- The output is similar to this : -->
240
+ <!--
241
+ The output is similar to this :
242
+ -->
231
243
输出和下面类似:
232
244
233
245
` ` ` yaml
@@ -239,6 +251,8 @@ metadata:
239
251
...
240
252
name: regcred
241
253
...
254
+ data:
255
+ .dockerconfigjson: eyJodHRwczovL2luZGV4L ... J0QUl6RTIifX0=
242
256
type: kubernetes.io/dockerconfigjson
243
257
` ` `
244
258
@@ -256,11 +270,13 @@ readable format:
256
270
kubectl get secret regcred --output="jsonpath={.data.\. dockerconfigjson}" | base64 --decode
257
271
` ` `
258
272
259
- <!-- The output is similar to this : -->
273
+ <!--
274
+ The output is similar to this :
275
+ -->
260
276
输出和下面类似:
261
277
262
278
` ` ` json
263
- {"auths":{"yourprivateregistry .com":{"username":"janedoe","password":"xxxxxxxxxxx","email":"[email protected] ","auth":"c3R...zE2"}}}
279
+ {"auths":{"your.private.registry.example .com":{"username":"janedoe","password":"xxxxxxxxxxx","email":"[email protected] ","auth":"c3R...zE2"}}}
264
280
` ` `
265
281
266
282
<!--
@@ -317,7 +333,7 @@ In file `my-private-reg-pod.yaml`, replace `<your-private-image>` with the path
317
333
在`my-private-reg-pod.yaml` 文件中,使用私有仓库的镜像路径替换 `<your-private-image>`,例如:
318
334
319
335
` ` ` none
320
- janedoe/jdoe-private:v1
336
+ your.private.registry.example.com/ janedoe/jdoe-private:v1
321
337
` ` `
322
338
323
339
<!--
@@ -353,4 +369,4 @@ kubectl get pod private-reg
353
369
* 进一步了解 [使用私有仓库](/zh-cn/docs/concepts/containers/images/#using-a-private-registry)
354
370
* 进一步了解 [为服务账户添加拉取镜像凭证](/zh-cn/docs/tasks/configure-pod-container/configure-service-account/#add-imagepullsecrets-to-a-service-account)
355
371
* 查看 [kubectl 创建 docker-registry 凭证](/docs/reference/generated/kubectl/kubectl-commands/#-em-secret-docker-registry-em-)
356
- * 查看 Pod [容器定义](/docs/reference/kubernetes-api/workload-resources/pod-v1/#containers)中的 `imagePullSecrets` 字段。
372
+ * 查看 Pod [容器定义](/zh-cn/ docs/reference/kubernetes-api/workload-resources/pod-v1/#containers)中的 `imagePullSecrets` 字段。
0 commit comments