Sign docker images with Cosign

Prepare environment

sudo apt update && sudo apt install -y ca-certificates curl gnupg
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Dockerfile (sample)

Build image docker

View image docker

Run image docker

View logs imagen docker

Push image docker to Docker Hub

Sign image docker

Install cosign

https://github.com/sigstore/cosign/releases v2.2.0 latest

Generate public/private keys

or

Output

Option 1, Image signature with private key

Option 2, Image signature using web token

It generates a URL, to log in with our credentials

and returns a verification token that must be copied to the terminal

and it will sign the image, it generates a new tag in the image that we have in the repository.

Verify a Container’s signature

Última actualización

¿Te fue útil?