docker image 保存为tar的 批量选择指令
目的:将当前的非latest版本的fabric的image save 为tar。
通过多个命令最终逐个使用。
$ docker save [image-id] > \[path]\xxxx.tar
查询当前的image
$ docker image ls
结果:
[root@localhost ~]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
hyperledger/fabric-javaenv 1.4.4 4648059d209e 3 weeks ago 1.7GB
hyperledger/fabric-javaenv latest 4648059d209e 3 weeks ago 1.7GB
hyperledger/fabric-ca 1.4.4 62a60c5459ae 3 weeks ago 150MB
hyperledger/fabric-ca latest 62a60c5459ae 3 weeks ago 150MB
hyperledger/fabric-tools 1.4.4 7552e1968c0b 3 weeks ago 1.49GB
hyperledger/fabric-tools latest 7552e1968c0b 3 weeks ago 1.49GB
hyperledger/fabric-ccenv 1.4.4 ca4780293e4c 3 weeks ago 1.37GB
hyperledger/fabric-ccenv latest ca4780293e4c 3 weeks ago 1.37GB
hyperledger/fabric-orderer 1.4.4 dbc9f65443aa 3 weeks ago 120MB
hyperledger/fabric-orderer latest dbc9f65443aa 3 weeks ago 120MB
hyperledger/fabric-peer 1.4.4 9756aed98c6b 3 weeks ago 128MB
hyperledger/fabric-peer latest 9756aed98c6b 3 weeks ago 128MB
hyperledger/fabric-zookeeper 0.4.18 ede9389347db 5 weeks ago 276MB
hyperledger/fabric-zookeeper latest ede9389347db 5 weeks ago 276MB
hyperledger/fabric-kafka 0.4.18 caaae0474ef2 5 weeks ago 270MB
hyperledger/fabric-kafka latest caaae0474ef2 5 weeks ago 270MB
hyperledger/fabric-couchdb 0.4.18 d369d4eaa0fd 5 weeks ago 261MB
hyperledger/fabric-couchdb latest d369d4eaa0fd 5 weeks ago 261MB
hyperledger/fabric-baseimage latest 9e353eca480f 5 weeks ago 1.3GB
hyperledger/fabric-baseos latest c256a6aad46f 5 weeks ago 80.8MB
hyperledger/composer-playground latest a9be6ec5a8ce 3 months ago 339MB
hello-world latest fce289e99eb9 11 months ago 1.84kB
hyperledger/fabric-membersrvc latest b3654d32e4f9 3 years ago 1.42GB
一条组合指令生成
$ docker image ls | grep fabric | grep -v latest | awk '{printf "docker save %s > \\home\\docker-image-backup\\%s.tar\n",$3,$1}' | sed 's/hyperledger\///'
docker save 4648059d209e > \home\docker-image-backup\fabric-javaenv.tar
docker save 62a60c5459ae > \home\docker-image-backup\fabric-ca.tar
docker save 7552e1968c0b > \home\docker-image-backup\fabric-tools.tar
docker save ca4780293e4c > \home\docker-image-backup\fabric-ccenv.tar
docker save dbc9f65443aa > \home\docker-image-backup\fabric-orderer.tar
docker save 9756aed98c6b > \home\docker-image-backup\fabric-peer.tar
docker save ede9389347db > \home\docker-image-backup\fabric-zookeeper.tar
docker save caaae0474ef2 > \home\docker-image-backup\fabric-kafka.tar
docker save d369d4eaa0fd > \home\docker-image-backup\fabric-couchdb.tar