#!/bin/bash
delete=$(docker ps | grep -v CONTAINER|awk '{print "docker rmi",$2".bak"}' > /data/dockerbak/dockerDelete)
bak=$(docker ps | grep -v CONTAINER|awk '{print "docker commit -p",$1,$2".bak"}' > /data/dockerbak/dockerBak)
save=$(docker ps | grep -v CONTAINER|awk '{print "docker save -o","/data/dockerbak/"$2".bak.tar",$2".bak"}' > /data/dockerbak/dockerSave)
while read line
do
$line
done < dockerDelete
while read line
do
$line
done < dockerBak
while read line
do
$line
done < dockerSave
备份docker所有镜像脚本
发布于 2022-12-12 359 次阅读
Comments NOTHING