Navigation Menu

Skip to content

Commit

Permalink
✨ feat(images): 增加单镜像导出
Browse files Browse the repository at this point in the history
增加单镜像导出

Signed-off-by: mritd <mritd1234@gmail.com>
  • Loading branch information
mritd committed Jan 12, 2018
1 parent deea5d2 commit 8ab81ba
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion export_docker_images.sh
@@ -1,2 +1,14 @@
#!/bin/bash
for imageName in `docker images | grep -v "REPOSITORY" | awk '{print $1":"$2}'`;do docker save $imageName > `echo $imageName | tr '/' '_' | tr ':' '_'`.tar ; done

set -e

if [ "$1" == "" ]; then
echo -e "\033[31mError: imageName is blank!\033[0m"
exit 1
elif [ "$1" == "all" ]; then
for imageName in `docker images | grep -v "REPOSITORY" | awk '{print $1":"$2}'`; do
docker save $imageName > `echo $imageName | tr '/' '_' | tr ':' '_'`.tar
done
else
docker save $1 > `echo $1 | tr '/' '_' | tr ':' '_'`.tar
fi

0 comments on commit 8ab81ba

Please sign in to comment.