Status | stable |
OCI Reference | cgr.dev/chainguard/cosign |
- View Image in Chainguard Academy
- View Image Catalog for a full list of available tags. Contact Chainguard for enterprise support, SLAs, and access to older tags.
Minimalist Wolfi-based Cosign images for signing and verifying images using Sigstore.
Our latest
tag uses the most recent build of the Wolfi Cosign package. The following tagged variant is available without authentication:
latest
: This is an image for runningcosign
commands. It does not include a shell or other applications.
This will automatically pull the image to your local system and execute the command cosign version
:
docker run --rm cgr.dev/chainguard/cosign version
You should see output similar to this:
______ ______ _______. __ _______ .__ __.
/ | / __ \ / || | / _____|| \ | |
| ,----'| | | | | (----`| | | | __ | \| |
| | | | | | \ \ | | | | |_ | | . ` |
| `----.| `--' | .----) | | | | |__| | | |\ |
\______| \______/ |_______/ |__| \______| |__| \__|
cosign: A tool for Container Signing, Verification and Storage in an OCI registry.
...
Platform: linux/arm64
For example, from GitHub Actions:
on:
push:
env:
IMAGE: ghcr.io/${{ github.repository }}
DOCKER_CONFIG: .docker-tmp
jobs:
push-and-sign:
runs-on: ubuntu-latest
permissions:
id-token: write
packages: write
steps:
- name: Login to registry
run: |
set -x
mkdir -p "${DOCKER_CONFIG}"
echo '{}' > "${DOCKER_CONFIG}/config.json"
echo "${{ github.token }}" | docker login \
-u "${{ github.repository_owner }}" \
--password-stdin ghcr.io
- name: Push image with docker
run: |
set -x
docker pull alpine:latest
docker tag alpine:latest "${IMAGE}"
docker push "${IMAGE}"
- name: Sign image with cosign
run: |
set -x
env | grep -v ^HOME= > github-actions.txt
docker run --rm --env-file=./github-actions.txt \
-v "${PWD}/${DOCKER_CONFIG}:/tmp/${DOCKER_CONFIG}" \
-e DOCKER_CONFIG="/tmp/${DOCKER_CONFIG}" \
cgr.dev/chainguard/cosign \
sign "${IMAGE}" \
--yes \
-a sha=${{ github.sha }} \
-a run_id=${{ github.run_id }} \
-a run_attempt=${{ github.run_attempt }}
To verify an image signature, use the image to run Cosign's verify
command. Since as of Cosign 2.0, Cosign defaults to using Sigstore's keyless mode, you'll need to also specify the OIDC issuer and signer identity to tell Cosign who you trust for the verification process.
For convenience, you can export those values as environment variables in your shell, and then tell Docker to pass those environment variables into the running Cosign container.
For example, to use the Cosign image to verify the signature of the Cosign image itself:
export COSIGN_CERTIFICATE_OIDC_ISSUER=https://token.actions.githubusercontent.com
export COSIGN_CERTIFICATE_IDENTITY=https://github.com/chainguard-images/images/.github/workflows/release.yaml@refs/heads/main
docker run --rm \
-e COSIGN_CERTIFICATE_OIDC_ISSUER \
-e COSIGN_CERTIFICATE_IDENTITY \
cgr.dev/chainguard/cosign \
verify cgr.dev/chainguard/cosign
To obtain detailed information about the environment, you can run the cosign env
command:
docker run --rm cgr.dev/chainguard/cosign env --show-descriptions=false