bazel-contrib / bazel-contrib/rules_oci

oci_load incompatible with older version of Podman

Open Beginner friendly
#711 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Starlark
Stars
423
Forks
213
Avg merge
53m
Merged PRs (30d)
1

Description

I'm running Bazel v7.2.0, rules_oci v2.0.0 on an Ubuntu 22.04.5 LTS system. I've installed the Ubuntu package for podman which is currently v3.4.4.

My build uses `oci_load` to build and import containers into podman:

```
oci_load(
name = "foobar_tarball",
image = ":foobar_image",
repo_tags = ["foobar:latest"],
)
```

The resulting script fails to run:

```
$ bazel-out/aarch64-fastbuild/bin/foobar_tarball.sh
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
Error: payload does not match any of the supported image formats (oci, oci-archive, dir, docker-archive)
tar: Write error
```

Looking into the issue, this appears to be a compatibility issue with how older versions of podman implement `podman load`. In particular the following two commands lines work differently:

```
# fails with "payload does not match any of the supported image formats"
podman load --input <(tar -c $FILES)
# succeeds and loads the image
tar -c $FILES | podman load
```

This issue appears fixed in newer versions of podman, however I haven't tracked down the details.

The fix is relatively straightforward; to change the `podman load` command line [oci/private/load.sh.tpl](https://github.com/bazel-contrib/rules_oci/blob/a002dafcddffecf5a670adaea53bcb7a4ee4eeb5/oci/private/load.sh.tpl#L31-L33)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with oci/private/load.sh.tpl around the podman load command and reproduce the generated foobar_tarball.sh behavior using Podman 3.4.4 on Ubuntu. Verify the resulting script loads the image successfully with the older Podman interface while preserving compatibility with newer versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
build-system, devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.