一键保存和加载批量镜像的脚本文件
1、将系统中的镜像一键保存到本地
(1)创建脚本文件
创建save-images.sh,将以下代码复制到save-images.sh文件中
#!/bin/bash
#Output the information of images to images.txt
sudo docker image ls >images.txt
#Get the number of images according to the total of content's rows
N=$(awk 'END{print NR}' images.txt)
echo The total of images is $N
#Get names and tags of images
for ((i=2; i<=$N; i++))
do
image=$(awk 'NR=="'"$i"'" {print $1}'</