参考地址:containerd/config.md at main · containerd/containerd · GitHub

1. 修改Config.toml文件

[plugins."io.containerd.grpc.v1.cri".registry]
      config_path = "/etc/containerd/certs.d"  # 镜像地址配置文件

      [plugins."io.containerd.grpc.v1.cri".registry.auths]

      [plugins."io.containerd.grpc.v1.cri".registry.configs]

      [plugins."io.containerd.grpc.v1.cri".registry.headers]

      [plugins."io.containerd.grpc.v1.cri".registry.mirrors]

2. 创建相应目录

mkdir /etc/containerd/certs.d/docker.io -pv

3. 配置加速

cat > /etc/containerd/certs.d/docker.io/hosts.toml << EOF
server = "https://docker.io"
[host."https://xxxxxxxx.mirror.aliyuncs.com"]
  capabilities = ["pull", "resolve"]
EOF

4. 重启Containerd

systemctl restart containerd

5. 重新拉取镜像

ctr i pull docker.io/library/mysql:latest
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐