ctr镜像导入

ctr-save-img.sh

1
2
3
4
5
6
7
8
#!/bin/bash
images=$(ctr -n=k8s.io images  ls -q | grep -v @ | grep -v sha256)
for image in ${images}; do
    filename=$(echo ${image} | sed 's/\//_/g' | sed 's/:/_/g')
    echo "Exporting ${image} to ${filename}.tar..."
    ctr -n=k8s.io images export ${filename}.tar ${image}
done
echo "All images exported."

ctr-import-img.sh

1
2
3
4
5
6
7
#!/bin/bash
images=$(ls *.tar)
for image in ${images}; do
    echo "Importing ${image}..."
    ctr -n=k8s.io image import ${image}
done
echo "All images imported."
Licensed under CC BY-NC-SA 4.0
最后更新于 Sep 10, 2025 02:16 UTC
comments powered by Disqus
Built with Hugo
主题 StackJimmy 设计
Caret Up