备份本机所有Docker Images:
docker images | awk '{print $1}' | grep -v REPOSITORY | awk '{cmd="docker save -o "$1".tar "$1;print(cmd);system(cmd);cmd="tar czvf "$1".tar.gz "$1".tar"; print(cmd);system(cmd);cmd="rm -f "$1".tar";print(cmd); system(cmd)}'
恢复所有docker镜像
ls *.gz | awk '{cmd="tar zxvf "$1;system(cmd)}'
ls *.tar | awk '{cmd="docker load -i ./"$1;system(cmd)}'
网友评论