Skip to main content
Version: 1.16.x

defs

Exposes container-structure-test as a Bazel rule

Rules

container_structure_test

Tests a Docker- or OCI-format image.

By default, it relies on the container runtime already installed and running on the target.

By default, container-structure-test uses the socket available at /var/run/docker.sock. If the installation creates the socket in a different path, use --test_env=DOCKER_HOST='unix://<path_to_sock>'.

To avoid putting this into the commandline or to instruct bazel to read it from terminal environment, simply add test --test_env=DOCKER_HOST into the .bazelrc file.

Alternatively, use the driver = "tar" attribute to avoid the need for a container runtime, see https://github.com/GoogleContainerTools/container-structure-test#running-file-tests-without-docker

Example usage (generated):

load("@container_structure_test//:defs.bzl", "container_structure_test")

container_structure_test(
# A unique name for this target.
name = "",
configs = [],
)

name

Required name.

A unique name for this target.

configs

Required list of labels.

driver

Optional string. Default: "docker"

See https://github.com/GoogleContainerTools/container-structure-test#running-file-tests-without-docker

image

Optional label. Default: None

Label of an oci_image or oci_tarball target.