tuna
tuna

Reputation: 308

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.

Upvotes: 7

Views: 1292

Answers (2)

BMitch
BMitch

Reputation: 265200

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.

Upvotes: 1

Winbobob
Winbobob

Reputation: 389

You cannot use docker import or docker load for the OCI image tarball directly. But there are three alternatives:

  • Option 1. use --output=type=docker,dest=/some/path/foo.tar. A tarball will be generated. You can then load the tarball by using docker load -i /some/path/foo.tar.
  • Option 1.1 if you do not want the output tarball, you can use --load option (docker doc). You can then find the loaded docker image by running docker images.
  • Option 2. you could write your own upload binary and take advantage of existing lib like ocipush.

Upvotes: 1

Related Questions