Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oci_tarball for multiarch image fails with blobs/json: no such file or directory #651

Open
exp0nge opened this issue Jul 12, 2024 · 11 comments
Labels
documentation Improvements or additions to documentation works as intended This feature/api works as intended, there is nothing to fix.

Comments

@exp0nge
Copy link

exp0nge commented Jul 12, 2024

bazel: 5.4.1
rules_oci version: 1.7.6
Runtimes:

  • M1 Docker with containerd enabled
  • Linux/amd64: runc

Snippet of the tarball:

oci_image(
    name = "image-linux_x86_64",
    base = "@bookworm_base_linux_amd64",
    cmd = ["./linux_x86_64"],
    tars = [":tar-linux_x86_64"],
    visibility = ["//visibility:public"],
    workdir = "/",
)

oci_image(
    name = "image-linux_arm64",
    base = "@bookworm_base_linux_arm64_v8",
    cmd = ["./linux_arm64"],
    tars = [":tar-linux_arm64"],
    visibility = ["//visibility:public"],
    workdir = "/",
)

oci_image_index(
    name = "image-multiarch",
    images = [
        ":image-linux_arm64",
        ":image-linux_x86_64",
    ],
)

oci_tarball(
    name = "tarball_multiarch",
    format = "oci",
    image = ":image-multiarch",
    repo_tags = ["multiarch:latest"],
)

This ends up with

❯ bazel run src/app:tarball_multiarch
open /var/lib/docker/tmp/docker-import-1480447137/blobs/json: no such file or directory

Tried directly:

❯ docker load < bazel-bin/src/app/tarball_multiarch/tarball.tar
open /var/lib/docker/tmp/docker-import-2417380582/blobs/json: no such file or directory
@thesayyn
Copy link
Collaborator

It's possible that this is already fixed, could try and see if this is present in https://github.com/bazel-contrib/rules_oci/releases/tag/v1.8.0?

@ekhabarov
Copy link

Encountered the same issue with the tarball target where format="oci" and image = ":image-index". Tried v1.8.0 but it has another issue #653 at least on Mac M2.

@ekhabarov
Copy link

It's possible that this is already fixed, could try and see if this is present in https://github.com/bazel-contrib/rules_oci/releases/tag/v1.8.0?

Tried v1.8.0 without #602, still the same error.

@exp0nge
Copy link
Author

exp0nge commented Jul 17, 2024

It's possible that this is already fixed, could try and see if this is present in https://github.com/bazel-contrib/rules_oci/releases/tag/v1.8.0?

Same error also on v1.8.0

@thesayyn
Copy link
Collaborator

thesayyn commented Jul 25, 2024

Tried v1.8.0 without #602, still the same error.

Are these two related? because #602 is about oci_pull whereas this issue is about oci_tarball.

@thesayyn thesayyn added bug Something isn't working need: information We need more information to identify the bug labels Jul 25, 2024
@ekhabarov
Copy link

ekhabarov commented Jul 25, 2024

Tried v1.8.0 without #602, still the same error.

Are these two related? because #602 is about oci_pull whereas this issue is about oci_tarball.

I don't think so. I mentioned it because version upgrade 1.7.6 => 1.8.0 brought a different error. Details are in #653

@chulkilee
Copy link

It still fails on the main branch at

"$CONTAINER_CLI" load --input <(

Seems like docker load requires docker-specific metadata which is not present in oci formats.

If docker format itself supports multi-arch images, then probably we have to implement that in rules_oci - probably at oci/private/tarball.sh.tpl

@chulkilee
Copy link

docker engine 27.2.0 seems to support loading oci image but I still get the same error.

moby/moby#44833

You can test it by adding followings to examples/multi_architecture_image/BUILD.bazel and run bazel run //examples/multi_architecture_image:load

oci_load(
    name = "load",
    image = ":index",
    repo_tags = ["my-repository:latest"],
    format = "oci",
)

@thesayyn
Copy link
Collaborator

thesayyn commented Sep 9, 2024

Docker by default does not support loading oci tarballs into the daemon, that's probably what you are seeing here. Please make sure that you enabled containerd image store experiment if you are using docker.

https://docs.docker.com/desktop/containerd/

@thesayyn thesayyn added documentation Improvements or additions to documentation works as intended This feature/api works as intended, there is nothing to fix. and removed bug Something isn't working need: information We need more information to identify the bug labels Sep 9, 2024
@thesayyn
Copy link
Collaborator

thesayyn commented Sep 9, 2024

This issue is now a documentation issue. Need to mention enabling containerd image store.

@exp0nge
Copy link
Author

exp0nge commented Sep 9, 2024

This issue is now a documentation issue. Need to mention enabling containerd image store.

I reported this issue and used containerd in darwin/arm64 and runc debian/amd64. Has it been fixed when using containerd?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation works as intended This feature/api works as intended, there is nothing to fix.
Projects
None yet
Development

No branches or pull requests

4 participants