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_load incompatible with older version of Podman #711

Open
nholstein opened this issue Oct 9, 2024 · 0 comments · May be fixed by #712
Open

oci_load incompatible with older version of Podman #711

nholstein opened this issue Oct 9, 2024 · 0 comments · May be fixed by #712
Labels
bug Something isn't working

Comments

@nholstein
Copy link

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

nholstein added a commit to nholstein/rules_oci that referenced this issue Oct 9, 2024
Older versions of Podman appear to handle loading a tarball differently
depending upon with the input is /dev/stdin or not. In particular:

    podman load --input <(cat foo.tar)

raises an error, while:

    cat foo.tar | podman load

works without error. (Podman loads from stdin if no --input is specified.)

This enables support for podman v3.4.4 included in Ubuntu 22.04.

fixes bazel-contrib#711
@nholstein nholstein linked a pull request Oct 9, 2024 that will close this issue
@thesayyn thesayyn added the bug Something isn't working label Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants