有没有办法我们可以在不使用docker pull的情况下下载容器图像。 我想将多个容器运送到不能访问互联网的不同环境。
目前我正在关注
答案 0 :(得分:0)
如果你的图像彼此依赖,那么最好的办法就是对最复杂的图像(构建在其他图像之上的图像)进行docker run
:这将触发所有图像的docker pull
构建复杂图像的图像。
但是对于不相关的图像,你仍然需要单独拉它们。
我不知道如何在脚本旁边保存所有图像。
例如,请参阅save-all-images.sh
中的lalyos。
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
}