wget https://github.com/containerd/nerdctl/releases/download/v0.22.0/nerdctl-0.22.0-linux-amd64.tar.gz tar -zxvf nerdctl-0.22.0-linux-amd64.tar.gz cp nerdctl /usr/local/bin/
wget https://github.com/containernetworking/plugins/releases/download/v1.1.1/cni-plugins-linux-amd64-v1.1.1.tgz mkdir /opt/cni/bin -p tar -zxvf cni-plugins-linux-amd64-v1.1.1.tgz -C /opt/cni/bin/
wget https://github.com/moby/buildkit/releases/download/v0.10.3/buildkit-v0.10.3.linux-amd64.tar.gz tar -zxvf buildkit-v0.10.3.linux-amd64.tar.gz cp -a bin/buildkitd bin/buildctl /usr/local/bin/
cat <<EOF > /lib/systemd/system/buildkit.socket [Unit] Description=BuildKit Documentation=https://github.com/moby/buildkit [Socket] ListenStream=%t/buildkit/buildkitd.sock [Install] WantedBy=sockets.target EOF
1
2
3
4
5
6
7
8
9
10
11
12
|
cat <<EOF > /lib/systemd/ system /buildkitd.service [Unit] Description=BuildKit Requires=buildkit.socket After=buildkit.socketDocumentation=https: //github.com/moby/buildkit [Service] ExecStart=/usr/local/bin/buildkitd --oci-worker= false --containerd-worker= true [Install] WantedBy=multi-user.target EOF |
systemctl daemon-reload systemctl start buildkitd systemctl enable buildkitd
nerdctl login --resecure-registry harbor.wyh.net
mkdir /etc/containerd/certs.d/harbor.wyh.net -p
openssl x509 -inform PEM -in harbor.wyh.net.crt -out harbor.wyh.net.cert
scp ca.crt harbor.wyh.net.cert harbor.wyh.net.key 192.168.213.11://etc/containerd/certs.d/harbor.wyh.net
nerdctl login harbor.wyh.net

cat <<EOF >/etc/nerdctl/nerdctl.toml namespace = "k8s.io" EOF

- 使用正规机构颁发的证书(网上有免费申请的地方)
- 在harbor前面部署nginx,nginx来挂证书,同时支持http和https
docker-compose stop
vim harbor.yml

./prepare
docker-compose up -d


- 修改containerd的配置文件,改成http访问
- 在harbor前面部署一个nginx,nginx配置https访问
mkdir /etc/{buildkit,nerdctl}
cat <<EOF >/etc/buildkit/buildkitd.toml [registry."harbor.wyh.net"] http = true insecure = true EOF
cat <<EOF >/etc/nerdctl/nerdctl.toml namespace = "k8s.io" debug = false debug_full = false insecure_registry = true EOF
