|Index|SUSE Telco Cloud 文档|电信功能配置|私有镜像仓库配置
适用范围 SUSE Telco Cloud 3.7

46 私有镜像仓库配置

可以配置 Containerd 以连接到私有镜像仓库,并使用它们在每个节点上拉取私有镜像。

启动时,RKE2 会检查 /etc/rancher/rke2/ 处是否存在 registries.yaml 文件,并指示 containerd 使用文件中定义的任何镜像仓库。如果您希望使用私有镜像仓库,请以 root 用户身份在每个将使用该镜像仓库的节点上创建此文件。

要添加私有镜像仓库,请创建文件 /etc/rancher/rke2/registries.yaml 并填入以下内容:

mirrors:
  docker.io:
    endpoint:
      - "https://registry.example.com:5000"
configs:
  "registry.example.com:5000":
    auth:
      username: xxxxxx # this is the registry username
      password: xxxxxx # this is the registry password
    tls:
      cert_file:            # path to the cert file used to authenticate to the registry
      key_file:             # path to the key file for the certificate used to authenticate to the registry
      ca_file:              # path to the ca file used to verify the registry's certificate
      insecure_skip_verify: # may be set to true to skip verifying the registry's certificate

或无需身份验证:

mirrors:
  docker.io:
    endpoint:
      - "https://registry.example.com:5000"
configs:
  "registry.example.com:5000":
    tls:
      cert_file:            # path to the cert file used to authenticate to the registry
      key_file:             # path to the key file for the certificate used to authenticate to the registry
      ca_file:              # path to the ca file used to verify the registry's certificate
      insecure_skip_verify: # may be set to true to skip verifying the registry's certificate

为了使镜像仓库的更改生效,您需要在节点上启动 RKE2 之前配置此文件,或者在每个已配置的节点上重启 RKE2。

注意
注意

有关此内容的更多信息,请查看 containerd 镜像仓库配置 rke2。