简体   繁体   English

没有“ docker pull”的散装容器图像拉

[英]Bulk Container image pull without “docker pull”

Is there any way we can download container images without using docker pull. 有没有办法我们可以下载容器图像而不使用docker pull。 I want to ship multiple containers to different environments which do not have internet access. 我想将多个容器运送到不具有Internet访问权限的不同环境中。

Currently I am following 目前我正在关注

  1. Download image one by image using docker pull command 使用docker pull命令逐张下载映像
  2. docker save image.tar docker save image.tar
  3. Copy tar to destination 将tar复制到目标
  4. docker load 码头工人负载

If your images depends one from another, a trick would be to do a docker run of the most complex image (the one built on top of the others): that would trigger a docker pull of all the images FROM which the complex one is built. 如果您的映像彼此依赖,那么一个窍门就是对最复杂的映像(在另一个映像之上构建)进行docker run :这将触发从中生成复杂映像的所有映像的docker pull

But for unrelated images, you would still need to pull them individually. 但对于不相关的图像,您仍然需要单独拉出它们。

I don't know of a way to save all image beside a script. 我不知道如何在脚本旁边保存所有图像。
See for instance save-all-images.sh from lalyos . 例如,请参阅save-all-images.shsave-all-images.sh

save-all-image() {
  local ids=$(docker images -q)
  local name safename tag

  for id in $ids; do
    name=$(get-image-name $id)
    tag=$(get-image-tag $id)
    if [[  $name =~ / ]] ; then
       dir=${name%/*}
       mkdir -p $dir
    fi
    echo [DEBUG] save $name:$tag ...
    (time  docker save -o $name.$tag.dim $name:$tag) 2>&1|grep real
  done
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM