How-to export a container image to OCI

Hi,

Would you be so kind to advise how one can export a container’s image to a .tar file in the OCI format?

  • without running a container
  • with whatever tool you wish

Below 1) is an attempt, but how to verify it? 2) is based on Exporters overview | Docker Docs, but am trying to understand the difference between the two commands
1)
docker export $(docker create <image-name>) | tar -xC <filename>
2)

docker buildx build --output type=oci,dest=filename.tar .
docker buildx build --output type=tar,dest=pathname .

Use docker save to export an image to a tar file

but, is that in OCI format?

If you read further under docker exporters, what you probably want ia

docker buildx build --output type=oci,tar .

which should build an image, export it as COI and tar it.

If you already have an image in docker format, then skopeo should be able to convert it.