Skip to content

Commit

Permalink
docs: update registry config guide
Browse files Browse the repository at this point in the history
Signed-off-by: Shuaiyi Zhang <zhang_syi@qq.com>
  • Loading branch information
ZhangShuaiyi committed Apr 22, 2024
1 parent 8eb03f1 commit c514630
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
37 changes: 36 additions & 1 deletion docs/cri/registry.md
Expand Up @@ -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
> have been DEPRECATED. As described in [the cri config](./config.md#registry-configuration) you
> should now use the following configuration
+ Before containerd 2.0
```toml
[plugins."io.containerd.grpc.v1.cri".registry]
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

Expand All @@ -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
`/etc/containerd/config.toml` as follows:

+ Before containerd 2.0
```toml
# explicitly use v2 config format
version = 2
Expand All @@ -32,6 +39,19 @@ version = 2
auth = ""
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`.

Expand Down Expand Up @@ -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`)
to add your JSON key for `gcr.io` domain image pull
requests:

+ Before containerd 2.0
```toml
version = 2

Expand All @@ -90,6 +110,21 @@ version = 2
username = "_json_key"
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.
Expand Down
8 changes: 8 additions & 0 deletions docs/hosts.md
Expand Up @@ -33,12 +33,20 @@ been **DEPRECATED**._ You should now point your registry `config_path` to the pa
`hosts.toml` files are located.

Modify your `config.toml` (default location: `/etc/containerd/config.toml`) as follows:
+ Before containerd 2.0
```toml
version = 2

[plugins."io.containerd.grpc.v1.cri".registry]
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

Expand Down

0 comments on commit c514630

Please sign in to comment.