docs/cookbook/container: update docker image builder.

Apparently some newer docker versions crash if there is no "repository"
file in the resulting image.  Its syntax seems simple enough, described
in https://github.com/moby/moby/blob/master/image/spec/v1.md

Reported-by: Matthew Singletary <matt.singletary@gmail.com>
This commit is contained in:
Avery Pennarun 2019-03-05 21:49:36 -05:00
commit 7845f6ddde

View file

@ -29,6 +29,17 @@ for layer in $layers; do
ln "$layer.layer" "$dir/$cid/layer.tar" ln "$layer.layer" "$dir/$cid/layer.tar"
parent=$layer parent=$layer
done <$1.layers done <$1.layers
last_cid=$cid
tar -C "$dir" -cf - $ids >$3 # The seemingly-redundant "repositories" file seems to be needed by newer
# docker versions.
cat >"$dir/repositories" <<-EOF
{
"$2":{
"latest":"$last_cid"
}
}
EOF
tar -C "$dir" -cf - $ids repositories >$3
rm -rf "$dir" rm -rf "$dir"