Skip to content

Commit a7a74c8

Browse files
committed
Update translate-compose-kubernetes.md
1 parent 550f3e5 commit a7a74c8

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

content/zh-cn/docs/tasks/configure-pod-container/pull-image-private-registry.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ This page shows how to create a Pod that uses a
1717
{{< glossary_tooltip text="Secret" term_id="secret" >}} to pull an image
1818
from a private container image registry or repository. There are many private
1919
registries in use. This task uses [Docker Hub](https://www.docker.com/products/docker-hub)
20+
as an example registry.
2021
-->
2122
本文介绍如何使用 {{< glossary_tooltip text="Secret" term_id="secret" >}}
2223
从私有的镜像仓库或代码仓库拉取镜像来创建 Pod。
2324
有很多私有镜像仓库正在使用中。这个任务使用的镜像仓库是
24-
[Docker Hub](https://www.docker.com/products/docker-hub)
25+
[Docker Hub](https://www.docker.com/products/docker-hub)
2526

2627
{{% thirdparty-content single="true" %}}
2728

@@ -45,12 +46,20 @@ registries in use. This task uses [Docker Hub](https://www.docker.com/products/d
4546
<!--
4647
## Log in to Docker
4748
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.
4950
-->
5051
## 登录 Docker 镜像仓库 {#log-in-to-docker}
5152

5253
在个人电脑上,要想拉取私有镜像必须在镜像仓库上进行身份验证。
5354

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+
5463
```shell
5564
docker login
5665
```
@@ -161,7 +170,8 @@ the base64 encoded string in the data was successfully decoded, but could not be
161170
如果你收到错误消息:`error: no objects passed to create`,
162171
这可能意味着 base64 编码的字符串是无效的。 如果你收到类似
163172
`Secret "myregistrykey" is invalid: data[.dockerconfigjson]: invalid value ...`
164-
的错误消息,则表示数据中的 base64 编码字符串已成功解码,但无法解析为 `.docker/config.json` 文件。
173+
的错误消息,则表示数据中的 base64 编码字符串已成功解码,
174+
但无法解析为 `.docker/config.json` 文件。
165175

166176
<!--
167177
## 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
227237
kubectl get secret regcred --output=yaml
228238
```
229239

230-
<!-- The output is similar to this: -->
240+
<!--
241+
The output is similar to this:
242+
-->
231243
输出和下面类似:
232244

233245
```yaml
@@ -239,6 +251,8 @@ metadata:
239251
...
240252
name: regcred
241253
...
254+
data:
255+
.dockerconfigjson: eyJodHRwczovL2luZGV4L ... J0QUl6RTIifX0=
242256
type: kubernetes.io/dockerconfigjson
243257
```
244258

@@ -256,11 +270,13 @@ readable format:
256270
kubectl get secret regcred --output="jsonpath={.data.\.dockerconfigjson}" | base64 --decode
257271
```
258272

259-
<!-- The output is similar to this: -->
273+
<!--
274+
The output is similar to this:
275+
-->
260276
输出和下面类似:
261277

262278
```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"}}}
264280
```
265281

266282
<!--
@@ -317,7 +333,7 @@ In file `my-private-reg-pod.yaml`, replace `<your-private-image>` with the path
317333
在`my-private-reg-pod.yaml` 文件中,使用私有仓库的镜像路径替换 `<your-private-image>`,例如:
318334

319335
```none
320-
janedoe/jdoe-private:v1
336+
your.private.registry.example.com/janedoe/jdoe-private:v1
321337
```
322338

323339
<!--
@@ -353,4 +369,4 @@ kubectl get pod private-reg
353369
* 进一步了解 [使用私有仓库](/zh-cn/docs/concepts/containers/images/#using-a-private-registry)
354370
* 进一步了解 [为服务账户添加拉取镜像凭证](/zh-cn/docs/tasks/configure-pod-container/configure-service-account/#add-imagepullsecrets-to-a-service-account)
355371
* 查看 [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

Comments
 (0)