bazel-contrib / bazel-contrib/rules_oci

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

Open
#651 15 comments 0 reactions 0 assignees View on GitHub
documentation help wanted
Dominant language
Starlark
Stars
423
Forks
213
Avg merge
53m
Merged PRs (30d)
1

Description

bazel: 5.4.1
rules_oci version: 1.7.6
Runtimes:
* M1 Docker with containerd enabled
* Linux/amd64: runc

Snippet of the tarball:

```bazel
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
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported `bazel run src/app:tarball_multiarch` failure with Bazel 5.4.1 and rules_oci 1.7.6, then inspect the `oci_tarball` handling of the `image-multiarch` index and OCI archive layout. The work is done when the generated `tarball_multiarch/tarball.tar` can be loaded successfully with `docker load` on the reported runtimes.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.