zoukankan      html  css  js  c++  java
  • docker 批量导出脚本

    用for 循环实现

    docker images
    REPOSITORY                                               TAG                 IMAGE ID            CREATED             SIZE
    gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64     1.14.4              21fe417043dd        2 months ago        41.4MB
    gcr.io/google_containers/kube-apiserver-amd64            v1.6.0              489cabacd734        9 months ago        150MB
    [root@hd11 ~]#

    docker images|sed -n '3,$p'|awk -F '[/]' '{print $3}'|awk '{print $1"_"$2".tar"}'


    k8s-dns-dnsmasq-nanny-amd64_1.14.4.tar
    kube-apiserver-amd64_v1.6.0.tar


    docker images|sed -n '3,$p'|awk '{print $1":"$2}'


    gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64:1.14.4
    gcr.io/google_containers/kube-apiserver-amd64:v1.6.0

    #!/bin/bash
    tar = `docker images|sed -n '3,$p'|awk -F '[/]' '{print $3}'|awk '{print $1"_"$2".tar"}'`
    images = `docker images|sed -n '3,$p'|awk '{print $1":"$2}'`
    for i in $tar
    do     for j in $images     do       docker save -o $i $j done done
  • 相关阅读:
    40-cut 简明笔记
    50-ln 简明笔记
    35-less 简明笔记
    37-more 简明笔记
    9-cat 简明笔记
    64-who 简明笔记
    60-chmod 修改文件的权限
    useradd 添加用户
    14-find 查找文件
    层次越低的人,越容易放弃自己
  • 原文地址:https://www.cnblogs.com/sxwen/p/8391820.html
Copyright © 2011-2022 走看看