Merge pull request #10075 from ZhangShuaiyi/fix/docs

docs: update registry config guide
This commit is contained in:
Maksym Pavlenko 2024-05-16 19:42:21 +00:00 committed by GitHub
commit 4fa8ce9d30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 44 additions and 1 deletions

View File

@ -5,10 +5,16 @@ This document describes the method to configure the image registry for `containe
> **_NOTE:_** registry.mirrors and registry.configs as previously described in this document > **_NOTE:_** registry.mirrors and registry.configs as previously described in this document
> have been DEPRECATED. As described in [the cri config](./config.md#registry-configuration) you > have been DEPRECATED. As described in [the cri config](./config.md#registry-configuration) you
> should now use the following configuration > should now use the following configuration
+ Before containerd 2.0
```toml ```toml
[plugins."io.containerd.grpc.v1.cri".registry] [plugins."io.containerd.grpc.v1.cri".registry]
config_path = "/etc/containerd/certs.d" config_path = "/etc/containerd/certs.d"
``` ```
+ In containerd 2.0
```toml
[plugins."io.containerd.cri.v1.images".registry]
config_path = "/etc/containerd/certs.d"
```
## Configure Registry Credentials ## Configure Registry Credentials
@ -20,6 +26,7 @@ This document describes the method to configure the image registry for `containe
To configure a credential for a specific registry, create/modify the To configure a credential for a specific registry, create/modify the
`/etc/containerd/config.toml` as follows: `/etc/containerd/config.toml` as follows:
+ Before containerd 2.0
```toml ```toml
# explicitly use v2 config format # explicitly use v2 config format
version = 2 version = 2
@ -32,6 +39,19 @@ version = 2
auth = "" auth = ""
identitytoken = "" identitytoken = ""
``` ```
+ In containerd 2.0
```toml
# explicitly use v3 config format
version = 3
# The registry host has to be a domain name or IP. Port number is also
# needed if the default HTTPS or HTTP port is not used.
[plugins."io.containerd.cri.v1.images".registry.configs."gcr.io".auth]
username = ""
password = ""
auth = ""
identitytoken = ""
```
The meaning of each field is the same with the corresponding field in `.docker/config.json`. The meaning of each field is the same with the corresponding field in `.docker/config.json`.
@ -75,7 +95,7 @@ Now that you know you can access your GCR from your terminal, it is now time to
Edit the containerd config (default location is at `/etc/containerd/config.toml`) Edit the containerd config (default location is at `/etc/containerd/config.toml`)
to add your JSON key for `gcr.io` domain image pull to add your JSON key for `gcr.io` domain image pull
requests: requests:
+ Before containerd 2.0
```toml ```toml
version = 2 version = 2
@ -90,6 +110,21 @@ version = 2
username = "_json_key" username = "_json_key"
password = 'paste output from jq' password = 'paste output from jq'
``` ```
+ In containerd 2.0
```toml
version = 3
[plugins."io.containerd.cri.v1.images".registry]
[plugins."io.containerd.cri.v1.images".registry.mirrors]
[plugins."io.containerd.cri.v1.images".registry.mirrors."docker.io"]
endpoint = ["https://registry-1.docker.io"]
[plugins."io.containerd.cri.v1.images".registry.mirrors."gcr.io"]
endpoint = ["https://gcr.io"]
[plugins."io.containerd.cri.v1.images".registry.configs]
[plugins."io.containerd.cri.v1.images".registry.configs."gcr.io".auth]
username = "_json_key"
password = 'paste output from jq'
```
> Note: `username` of `_json_key` signifies that JSON key authentication will be used. > Note: `username` of `_json_key` signifies that JSON key authentication will be used.

View File

@ -33,12 +33,20 @@ been **DEPRECATED**._ You should now point your registry `config_path` to the pa
`hosts.toml` files are located. `hosts.toml` files are located.
Modify your `config.toml` (default location: `/etc/containerd/config.toml`) as follows: Modify your `config.toml` (default location: `/etc/containerd/config.toml`) as follows:
+ Before containerd 2.0
```toml ```toml
version = 2 version = 2
[plugins."io.containerd.grpc.v1.cri".registry] [plugins."io.containerd.grpc.v1.cri".registry]
config_path = "/etc/containerd/certs.d" config_path = "/etc/containerd/certs.d"
``` ```
+ In containerd 2.0
```
version = 3
[plugins."io.containerd.cri.v1.images".registry]
config_path = "/etc/containerd/certs.d"
```
## Support for Docker's Certificate File Pattern ## Support for Docker's Certificate File Pattern