containerd&docker修改registry为aliyun镜像

containerd

# 该路径不存在文件/etc/containerd/config.toml 使用下面的命令
containerd config default> /etc/containerd/config.toml

vim config.toml
#在下面节点中修改
[plugins."io.containerd.grpc.v1.cri".registry]
   [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
       [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
          		endpoint = ["https://fsk4g3nu.mirror.aliyuncs.com"] //到此为配置文件默认生成,之后为需要添加的内容
   [plugins."io.containerd.grpc.v1.cri".registry.configs]//这个节点可以配置私有镜像仓库
   		 [plugins."io.containerd.grpc.v1.cri".registry.configs."192.168.66.4".tls]
          		insecure_skip_verify = true
       	 [plugins."io.containerd.grpc.v1.cri".registry.configs."192.168.66.4".auth]
          		username = "admin"
          		password = "Harbor12345"
# 重启containerd
systemctl restart containerd.service
systemctl status containerd.service

crictl info

docker

mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://fsk4g3nu.mirror.aliyuncs.com"],
"exec-opts":["native.cgroupdriver=systemd"]
}
EOF


systemctl daemon-reload ; systemctl restart docker;

docker info