jib icon indicating copy to clipboard operation
jib copied to clipboard

Investigate if it's feasible to use local Docker or tar base image when building multi-platform images

Open chanseokoh opened this issue 5 years ago • 7 comments

chanseokoh avatar Sep 03 '20 16:09 chanseokoh

About local Docker daemon images:

Note it is possible to pull an image to a Docker daemon even if the image platform doesn't match the platform running the daemon. (Of course, you can't run an image that doesn't match the machine platform.)

However, I doubted a local Docker daemon could host something like a manifest list. Tried buildx by following the doc to build multi-arch images but without pushing to a registry (i.e., without --push). As I expected, it shows a warning "no output specified".

$ docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 .
WARN[0000] No output specified for docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load 
[+] Building 24.0s (9/9) FINISHED                                                                                                                                                                                 
 => [internal] booting buildkit                                                                                                                                                                             16.7s
 => => pulling image moby/buildkit:buildx-stable-1                                                                                                                                                          15.5s
 => => creating container buildx_buildkit_mybuilder0                                                                                                                                                         1.2s
...

It's not feasible to use a base image from a Docker daemon when configuring multiple <platform>s at the moment. Potentially we could change our <from><image> config so that the user can configure multiple local Docker images with different architectures. However, I am not sure if this is worth considering. For now, I think we can just fail when given multiple platforms.

chanseokoh avatar Sep 23 '20 15:09 chanseokoh

About local tar images:

Haven't looked into it, but I speculate that a tar image (either OCI or Docker) can easily contain multiple images. Worth taking a look.

chanseokoh avatar Sep 23 '20 15:09 chanseokoh

But for now, I think these are a low priority and we can just fail when attempting to use a local base image with multiple platforms configured. Should be done before we can enable multi-platform image building.

chanseokoh avatar Sep 23 '20 15:09 chanseokoh

added some local tar buildx image info on issue #2751 if relevant

tom-haines avatar Aug 06 '21 07:08 tom-haines

@tom-haines thanks for the info!

chanseokoh avatar Aug 06 '21 15:08 chanseokoh

Using an OCI image tarball or even directory as a base image would make a lot of sense. Related: #2173

SgtSilvio avatar Jun 19 '22 21:06 SgtSilvio

It would also be of great help to output the built image into an oci directory structure instead of an oci tar, amending any existing index.

hypnoce avatar Sep 20 '22 06:09 hypnoce