Skip to main content
Version: 1.4.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 run :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 = "",
# a file containing repo_tags, one per line
repo_tags = "",
)

name

Required name.

A unique name for this target.

format

Optional string. Default: "docker"

Format of image to generate. Options are: docker, oci. Currently, when the input image is an image_index, only oci is supported, and when the input image is an image, only docker is supported. Conversions between formats may be supported in the future.

image

Required label.

Label of a directory containing an OCI layout, typically oci_image

repo_tags

Required label.

        a file containing repo_tags, one per line.