gcloud container binauthz

NAME
gcloud container binauthz - manage attestations for Binary Authorization on Google Cloud Platform
SYNOPSIS
gcloud container binauthzGROUP |COMMAND[GCLOUD_WIDE_FLAG]
DESCRIPTION
Binary Authorization is a feature which allows binaries to run on Google CloudPlatform only if they are appropriately attested. Binary Authorization isconfigured by creating a policy.
EXAMPLES
This example assumes that you have created a keypair using gpg, usually byrunninggpg --gen-key …, withName-Email set toattesting_user@example.com for your attestor.

First, some convenience variables for brevity:

ATTESTING_USER="attesting_user@example.com"DIGEST="000000000000000000000000000000000000000000000000000000000000abcd"ARTIFACT_URL="gcr.io/example-project/example-image@sha256:${DIGEST}"ATTESTOR_NAME="projects/example-project/attestors/canary"

Export your key's fingerprint (note this may differ based on version andimplementations of gpg):

gpg\--with-colons\--with-fingerprint\--force-v4-certs\--list-keys\"${ATTESTING_USER}"|grepfpr|cut--delimiter=':'--fields10

This should produce a 40 character, hexidecimal encoded string. Seehttps://tools.ietf.org/html/rfc4880#section-12.2for more information on key fingerprints.

Create your attestation payload:

gcloudcontainerbinauthzcreate-signature-payload\--artifact-url="${ARTIFACT_URL}"\  >example_payload.txt

Create a signature from your attestation payload:

gpg\--local-user"${ATTESTING_USER}"\--armor\--clearsign\--outputexample_signature.pgp\example_payload.txt

Upload the attestation:

gcloudcontainerbinauthzattestationscreate\--public-key-id=${KEY_FINGERPRINT}\--signature-file=example_signature.pgp\--artifact-url="${ARTIFACT_URL}"\--attestor=${ATTESTOR_NAME}

List the attestation by artifact URL.--format can be passed tooutput the attestations as json or another supported format:

gcloudcontainerbinauthzattestationslist\--artifact-url="${ARTIFACT_URL}"\--format=yaml----|-----BEGINPGPPUBLICKEYBLOCK-----Version:GnuPGv1SNIP-----ENDPGPPUBLICKEYBLOCK------|-----BEGINPGPSIGNEDMESSAGE-----Hash:SHA1SNIP-----BEGINPGPSIGNATURE-----Version:GnuPGv1SNIP-----ENDPGPSIGNATURE-----

List all artifact URLs on the project for which Container Analysis Occurrencesexist. This list includes the list of all URLs with BinAuthz attestations:

gcloudcontainerbinauthzattestationslist---https://gcr.io/example-project/example-image@sha256:000000000000000000000000000000000000000000000000000000000000abcd

Listing also works for kind=ATTESTATION_AUTHORITY attestations, just pass theattestor:

gcloudcontainerbinauthzattestationslist\--artifact-url="${ARTIFACT_URL}"\--attestor=${ATTESTOR_NAME}\--format=yaml
GCLOUD WIDE FLAGS
These flags are available to all commands:--help.

Run$gcloud help for details.

GROUPS
GROUP is one of the following:
attestations
Create and manage Google Binary Authorization attestations.
attestors
Create and manage Google Binary Authorization Attestors.
policy
Create and manage Google Binary Authorization policies.
COMMANDS
COMMAND is one of the following:
create-signature-payload
Create a JSON container image signature object.
NOTES
These variants are also available:
gcloudalphacontainerbinauthz
gcloudbetacontainerbinauthz

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-22 UTC.