经常需要导入很多的本地镜像包,有没有批量导入的方法呢 ,网上搜索并没有,
一直用 && 符号拼接导入,觉的麻烦。
今天正好想想自己写写批量导入的方法
# 使用sed 拼接命令 借助管道符 交给bash [root@c3 ~]# ll *.tar|awk '{print $NF}'|sed -r 's#(.*)#docker load -i 1#' |bash b28ef0b6fef8: Loading layer [==================================================>] 105.5 MB/105.5 MB 0b703c74a09c: Loading layer [==================================================>] 23.99 MB/23.99 MB 2eb1c9bfc5ea: Loading layer [==================================================>] 7.994 MB/7.994 MB ab016c9ea8f8: Loading layer [==================================================>] 146.4 MB/146.4 MB b7c56a9790e6: Loading layer [==================================================>] 2.332 MB/2.332 MB 3b2a1688b8f3: Loading layer [==================================================>] 3.584 kB/3.584 kB 3499b696191f: Loading layer [==================================================>] 1.536 kB/1.536 kB 0d67aa2185d5: Loading layer [==================================================>] 356.3 MB/356.3 MB 84bbcb8ef932: Loading layer [==================================================>] 362.5 kB/362.5 kB 156bc36c74a7: Loading layer [==================================================>] 1.698 MB/1.698 MB 9384f8c620b8: Loading layer [==================================================>] 338.9 kB/338.9 kB ac25a8397598: Loading layer [==================================================>] 3.584 kB/3.584 kB 61a39ec18558: Loading layer [==================================================>] 9.728 kB/9.728 kB 40caba409f3c: Loading layer [==================================================>] 868.9 kB/868.9 kB b8e1d28b7840: Loading layer [==================================================>] 4.608 kB/4.608 kB def95060ad1a: Loading layer [==================================================>] 75.72 MB/75.72 MB 0d21822b2d1e: Loading layer [==================================================>] 4.608 kB/4.608 kB 9288edafe57c: Loading layer [==================================================>] 9.216 kB/9.216 kB 3b27b9cf51a6: Loading layer [==================================================>] 4.608 kB/4.608 kB 08794ff8753b: Loading layer [==================================================>] 3.072 kB/3.072 kB 37986c5c5dff: Loading layer [==================================================>] 7.168 kB/7.168 kB 34bb0412a3f6: Loading layer [==================================================>] 12.29 kB/12.29 kB a3c8fec28548: Loading layer [==================================================>] 4.096 kB/4.096 kB 97ea05144034: Loading layer [==================================================>] 91.59 MB/91.59 MB 91712ab942c1: Loading layer [==================================================>] 6.656 kB/6.656 kB 47c867a3ad5b: Loading layer [==================================================>] 33.46 MB/33.46 MB 0b5f5fc52f96: Loading layer [==================================================>] 7.848 MB/7.848 MB 3a237a42f4dd: Loading layer [==================================================>] 99.15 MB/99.15 MB 5dacd731af1b: Loading layer [==================================================>] 58.45 MB/58.45 MB f411d8bde01c: Loading layer [==================================================>] 338.4 kB/338.4 kB 0aa7d65147ef: Loading layer [==================================================>] 10.44 MB/10.44 MB 3437f67a712b: Loading layer [==================================================>] 4.472 MB/4.472 MB ec41e34b35a0: Loading layer [==================================================>] 1.536 kB/1.536 kB 4ff100428dad: Loading layer [==================================================>] 41.24 MB/41.24 MB 8a1e8445b75e: Loading layer [==================================================>] 31.74 kB/31.74 kB 175ac41e6cf6: Loading layer [==================================================>] 3.584 kB/3.584 kB 84ba30da3a7d: Loading layer [==================================================>] 146.1 MB/146.1 MB 468c34a52d5e: Loading layer [==================================================>] 9.728 kB/9.728 kB 23524f68cdbc: Loading layer [==================================================>] 1.536 kB/1.536 kB 458d25c646d8: Loading layer [==================================================>] 46.15 MB/46.15 MB 97874ea0e7f9: Loading layer [==================================================>] 31.74 kB/31.74 kB 5075b9328698: Loading layer [==================================================>] 3.584 kB/3.584 kB 364557e875f1: Loading layer [==================================================>] 257.3 MB/257.3 MB 9209148debed: Loading layer [==================================================>] 9.728 kB/9.728 kB 82582edf9553: Loading layer [==================================================>] 1.536 kB/1.536 kB 071d8bd76517: Loading layer [==================================================>] 210.2 MB/210.2 MB 94f92cf98a8c: Loading layer [==================================================>] 5.12 kB/5.12 kB 2ed773af93f3: Loading layer [==================================================>] 309.9 MB/309.9 MB 90d1009ce6fe: Loading layer [==================================================>] 105.5 MB/105.5 MB c23711a84ad4: Loading layer [==================================================>] 23.99 MB/23.99 MB 8f7ee6d76fd9: Loading layer [==================================================>] 8.005 MB/8.005 MB 1850621c23b2: Loading layer [==================================================>] 2.172 MB/2.172 MB 360cf37035a0: Loading layer [==================================================>] 3.584 kB/3.584 kB 86becce36874: Loading layer [==================================================>] 1.536 kB/1.536 kB c4d1d52c9184: Loading layer [==================================================>] 316.9 MB/316.9 MB aac1e4a5b5f3: Loading layer [==================================================>] 2.56 kB/2.56 kB 5fa455f4ce63: Loading layer [==================================================>] 2.904 MB/2.904 MB 356951e1d24d: Loading layer [==================================================>] 1.895 MB/1.895 MB 79b6dea0cc2b: Loading layer [==================================================>] 29.11 MB/29.11 MB cca707905317: Loading layer [==================================================>] 2.56 kB/2.56 kB [root@c3 ~]# Loading layer [==========> ] 512 B/2.56 kB [root@c3 ~]# docker images