dockermultiplatformbuildxmultiarch

Loading or Pushing Multiplatform OCI Image Tarball


I have a tarball image which is built with docker buildx build for platforms linux/amd64 and linux/arm64 with argument --output=type=oci,dest=/some/path. I am not able to go back and rebuild image with --load or --push.

I would be appreciated if anyone can help me on this.

I have tried to import the tarball image using docker import but I got the error below everytime I tried:

docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "submariner-operator": executable file not found in $PATH: unknown.
ERRO[0000] error waiting for container: context canceled

And docker load gives this error:

open /var/lib/docker/tmp/docker-import-1168996138/blobs/json: no such file or directory

EDIT: Docker engine still does not seem to support loading an OCI image tarball (if it's not a Docker-compatible tarball) to the memory. However, several tools, such as regclient, oras, skopeo and crane, are available for copying and loading tarball images into memory, as mentioned here.


Solution

  • There are quite a few tools that would work with the OCI tar file to push to a registry. Of them, I'm familiar with crane from Google, oras from Microsoft, skopeo from RedHat, and regclient from myself.

    crane push $path $image
    oras cp --from-oci-layout $path $image
    skopeo copy oci-archive:$path docker://$image
    regctl image import $image $file
    regctl image copy ocidir://$dir $image
    

    What won't work on most installs is importing into the docker engine. They are adding support to load the OCI Layout directly, but I believe that's still in progress and requires experimental options. Until those updates get released, docker needs to dereference the image into its own store, which requires a single platform image, and it loses any data in the manifest used by registries. The result is the image digests may change, which is often undesirable for security reasons.