commit 5235fea7a0a390b853cdd81c4d08809154caac39 Author: agboola Date: Fri May 23 12:00:44 2025 +0100 Add dockersave.sh diff --git a/dockersave.sh b/dockersave.sh new file mode 100644 index 0000000..f55f289 --- /dev/null +++ b/dockersave.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +#files will be saved in the dir 'Docker_images' +mkdir Docker_images +cd Docker_images +directory=`pwd` +c=0 +#save the image names in 'list.txt' +doc= docker images | tail -n +2 | awk '{print $1}' > list.txt +printf "START \n" +input="$directory/list.txt" +#Check and create the image tar for the docker images +while IFS= read -r line +do + one=`echo $line | awk '{print $1}'` + two=`echo $line | awk '{print $1}' | cut -c 1-3` + if [ "$one" != "" ]; then + c=$((c+1)) + printf "\n $one \n $two \n" + docker save -o $two$c'.tar' $one + printf "Docker image number $c successfully converted: $two$c \n \n" + fi +done < "$input" \ No newline at end of file