Skip to main content
Version: 1.0.x

tarball

Create a tarball from oci_image that can be loaded by runtimes such as podman and docker.

For example, given an :image target, you could write

oci_tarball(
name = "tarball",
image = ":image",
repo_tags = ["my-repository:latest"],
)

and then run it in a container like so:

bazel build //path/to:tarball
docker load --input $(bazel cquery --output=files //path/to:tarball)
docker run --rm my-repository:latest

Rules

oci_tarball

Creates tarball from OCI layouts that can be loaded into docker daemon without needing to publish the image first.

Passing anything other than oci_image to the image attribute will lead to build time errors.

Example usage (generated):

load("@rules_oci//oci/private:tarball.bzl", "oci_tarball")

oci_tarball(
# A unique name for this target.
name = "",
# Label of a directory containing an OCI layout, typically `oci_image`
image = "",
)

name

Required name.

A unique name for this target.

image

Required label.

Label of a directory containing an OCI layout, typically oci_image

repo_tags

Optional label. Default: None

        a file containing repo_tags, one per line.