Creating a signed container image

To run OpenShift sandboxed containers 1.12 with Confidential Containers enabled, you must have the container (workload) image signed.

  1. Log in to your Quay registry by running the following command:
    $ docker login quay.io -u <username> -p <password>
  2. Pull the container image onto your local machine.
    $ docker pull quay.io/prometheus/busybox:latest
  3. Tag the container image to your repository in the Quay registry by running the following command:
    $ docker tag quay.io/prometheus/busybox:latest quay.io/<username>/busybox:latest
  4. Push the container image to your repository in the Quay registry by running the following command:
    $ docker push quay.io/<username>/busybox
  5. Install the Cosign Package by running the following command:
    $ rpm -ivh --nodeps --force https://github.com/sigstore/cosign/releases/download/v2.4.1/cosign-2.4.1-1.s390x.rpm
  6. Log in to your Quay registry using cosign by running the following command:
    $ cosign login quay.io --username='<username>' --password='<password>'
  7. Generate a key pair to sign the container image.
    $ cosign generate-key-pair

    This creates cosign.key and cosign.pub.

  8. Sign and verify the container image in the Quay registry with the private key by running the following command:
    $ cosign sign --key cosign.key quay.io/<username>/busybox
  9. Place the key under kbs directory by running the following command:
    $ mv cosign.pub kbs/
  10. Create the container image signature verification policy by performing the following steps:
    1. Create a containers-policy.json file with the signature verification according to the following example:
      {
          "default": [
          ],
          "transports": {
              "docker": {
                  "quay.io/<username>/busybox:latest":
                  [
                      {
                          "type": "sigstoreSigned",
                          "keyPath": "kbs:///default/img-sig/pub-key"
                      }
                  ]
              }
          }
      }
    2. Place the policy under kbs directory by running the following command:
      $ mv containers-policy.json kbs/osc