Chapter 10. Open Container Initiative support
Container registries were originally designed to support container images in the Docker image format. To promote the use of additional runtimes apart from Docker, the Open Container Initiative (OCI) was created to provide a standardization surrounding container runtimes and image formats. Most container registries support the OCI standardization as it is based on the Docker image manifest V2, Schema 2 format.
In addition to container images, a variety of artifacts have emerged that support not just individual applications, but also the Kubernetes platform as a whole. These range from Open Policy Agent (OPA) policies for security and governance to Helm charts and Operators that aid in application deployment.
Red Hat Quay is a private container registry that not only stores container images, but also supports an entire ecosystem of tooling to aid in the management of containers. Red Hat Quay strives to be as compatible as possible with the OCI 1.0 Image and Distribution specifications, and supports common media types like Helm charts (as long as they pushed with a version of Helm that supports OCI) and a variety of arbitrary media types within the manifest or layer components of container images. Support for such novel media types differs from previous iterations of Red Hat Quay, when the registry was more strict about accepted media types. Because Red Hat Quay now works with a wider array of media types, including those that were previously outside the scope of its support, it is now more versatile accommodating not only standard container image formats but also emerging or unconventional types.
In addition to its expanded support for novel media types, Red Hat Quay ensures compatibility with Docker images, including V2_2 and V2_1 formats. This compatibility with Docker V2_2 and V2_1 images demonstrates Red Hat Quay’s' commitment to providing a seamless experience for Docker users. Moreover, Red Hat Quay continues to extend its support for Docker V1 pulls, catering to users who might still rely on this earlier version of Docker images.
Support for OCI artifacts are enabled by default. Prior to this, OCI media types were enabled under the under the FEATURE_GENERAL_OCI_SUPPORT
configuration field.
Because all OCI media types are now enabled by default, use of FEATURE_GENERAL_OCI_SUPPORT
, ALLOWED_OCI_ARTIFACT_TYPES
, and IGNORE_UNKNOWN_MEDIATYPES
is no longer required.
Additionally, the FEATURE_HELM_OCI_SUPPORT
configuration field has been deprecated. This configuration field is no longer supported and will be removed in a future version of Red Hat Quay.
10.1. Helm and OCI prerequisites Copy linkLink copied to clipboard!
Helm simplifies how applications are packaged and deployed. Helm uses a packaging format called Charts which contain the Kubernetes resources representing an application. Red Hat Quay supports Helm charts so long as they are a version supported by OCI.
Use the following procedures to pre-configure your system to use Helm and other OCI media types.
10.1.1. Installing Helm Copy linkLink copied to clipboard!
Use the following procedure to install the Helm client.
Procedure
- Download the latest version of Helm from the Helm releases page.
Enter the following command to unpack the Helm binary:
tar -zxvf helm-v3.8.2-linux-amd64.tar.gz
$ tar -zxvf helm-v3.8.2-linux-amd64.tar.gz
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Move the Helm binary to the desired location:
mv linux-amd64/helm /usr/local/bin/helm
$ mv linux-amd64/helm /usr/local/bin/helm
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
For more information about installing Helm, see the Installing Helm documentation.
10.1.2. Upgrading to Helm 3.8 Copy linkLink copied to clipboard!
Support for OCI registry charts requires that Helm has been upgraded to at least 3.8. If you have already downloaded Helm and need to upgrade to Helm 3.8, see the Helm Upgrade documentation.
10.1.3. Enabling your system to trust SSL/TLS certificates used by Red Hat Quay Copy linkLink copied to clipboard!
Communication between the Helm client and Red Hat Quay is facilitated over HTTPS. As of Helm 3.5, support is only available for registries communicating over HTTPS with trusted certificates. In addition, the operating system must trust the certificates exposed by the registry. You must ensure that your operating system has been configured to trust the certificates used by Red Hat Quay. Use the following procedure to enable your system to trust the custom certificates.
Procedure
Enter the following command to copy the
rootCA.pem
file to the/etc/pki/ca-trust/source/anchors/
folder:sudo cp rootCA.pem /etc/pki/ca-trust/source/anchors/
$ sudo cp rootCA.pem /etc/pki/ca-trust/source/anchors/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the following command to update the CA trust store:
sudo update-ca-trust extract
$ sudo update-ca-trust extract
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.2. Using Helm charts Copy linkLink copied to clipboard!
Use the following example to download and push an etherpad chart from the Red Hat Community of Practice (CoP) repository.
Prerequisites
- You have logged into Red Hat Quay.
Procedure
Add a chart repository by entering the following command:
helm repo add redhat-cop https://redhat-cop.github.io/helm-charts
$ helm repo add redhat-cop https://redhat-cop.github.io/helm-charts
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the following command to update the information of available charts locally from the chart repository:
helm repo update
$ helm repo update
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the following command to pull a chart from a repository:
helm pull redhat-cop/etherpad --version=0.0.4 --untar
$ helm pull redhat-cop/etherpad --version=0.0.4 --untar
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the following command to package the chart into a chart archive:
helm package ./etherpad
$ helm package ./etherpad
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Successfully packaged chart and saved it to: /home/user/linux-amd64/etherpad-0.0.4.tgz
Successfully packaged chart and saved it to: /home/user/linux-amd64/etherpad-0.0.4.tgz
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Log in to Red Hat Quay using
helm registry login
:helm registry login quay370.apps.quayperf370.perfscale.devcluster.openshift.com
$ helm registry login quay370.apps.quayperf370.perfscale.devcluster.openshift.com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Push the chart to your repository using the
helm push
command:helm push etherpad-0.0.4.tgz oci://quay370.apps.quayperf370.perfscale.devcluster.openshift.com
$ helm push etherpad-0.0.4.tgz oci://quay370.apps.quayperf370.perfscale.devcluster.openshift.com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output:
Pushed: quay370.apps.quayperf370.perfscale.devcluster.openshift.com/etherpad:0.0.4 Digest: sha256:a6667ff2a0e2bd7aa4813db9ac854b5124ff1c458d170b70c2d2375325f2451b
Pushed: quay370.apps.quayperf370.perfscale.devcluster.openshift.com/etherpad:0.0.4 Digest: sha256:a6667ff2a0e2bd7aa4813db9ac854b5124ff1c458d170b70c2d2375325f2451b
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Ensure that the push worked by deleting the local copy, and then pulling the chart from the repository:
rm -rf etherpad-0.0.4.tgz
$ rm -rf etherpad-0.0.4.tgz
Copy to Clipboard Copied! Toggle word wrap Toggle overflow helm pull oci://quay370.apps.quayperf370.perfscale.devcluster.openshift.com/etherpad --version 0.0.4
$ helm pull oci://quay370.apps.quayperf370.perfscale.devcluster.openshift.com/etherpad --version 0.0.4
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output:
Pulled: quay370.apps.quayperf370.perfscale.devcluster.openshift.com/etherpad:0.0.4 Digest: sha256:4f627399685880daf30cf77b6026dc129034d68c7676c7e07020b70cf7130902
Pulled: quay370.apps.quayperf370.perfscale.devcluster.openshift.com/etherpad:0.0.4 Digest: sha256:4f627399685880daf30cf77b6026dc129034d68c7676c7e07020b70cf7130902
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.3. Cosign OCI support Copy linkLink copied to clipboard!
Cosign is a tool that can be used to sign and verify container images. It uses the ECDSA-P256
signature algorithm and Red Hat’s Simple Signing payload format to create public keys that are stored in PKIX files. Private keys are stored as encrypted PEM files.
Cosign currently supports the following:
- Hardware and KMS Signing
- Bring-your-own PKI
- OIDC PKI
- Built-in binary transparency and timestamping service
Use the following procedure to directly install Cosign.
Prerequisites
- You have installed Go version 1.16 or later.
-
You have set
FEATURE_GENERAL_OCI_SUPPORT
totrue
in yourconfig.yaml
file.
Procedure
Enter the following
go
command to directly install Cosign:go install github.com/sigstore/cosign/cmd/cosign@v1.0.0
$ go install github.com/sigstore/cosign/cmd/cosign@v1.0.0
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
go: downloading github.com/sigstore/cosign v1.0.0 go: downloading github.com/peterbourgon/ff/v3 v3.1.0
go: downloading github.com/sigstore/cosign v1.0.0 go: downloading github.com/peterbourgon/ff/v3 v3.1.0
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Generate a key-value pair for Cosign by entering the following command:
cosign generate-key-pair
$ cosign generate-key-pair
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Enter password for private key: Enter again: Private key written to cosign.key Public key written to cosign.pub
Enter password for private key: Enter again: Private key written to cosign.key Public key written to cosign.pub
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sign the key-value pair by entering the following command:
cosign sign -key cosign.key quay-server.example.com/user1/busybox:test
$ cosign sign -key cosign.key quay-server.example.com/user1/busybox:test
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Enter password for private key: Pushing signature to: quay-server.example.com/user1/busybox:sha256-ff13b8f6f289b92ec2913fa57c5dd0a874c3a7f8f149aabee50e3d01546473e3.sig
Enter password for private key: Pushing signature to: quay-server.example.com/user1/busybox:sha256-ff13b8f6f289b92ec2913fa57c5dd0a874c3a7f8f149aabee50e3d01546473e3.sig
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you experience the
error: signing quay-server.example.com/user1/busybox:test: getting remote image: GET https://quay-server.example.com/v2/user1/busybox/manifests/test: UNAUTHORIZED: access to the requested resource is not authorized; map[]
error, which occurs because Cosign relies on~./docker/config.json
for authorization, you might need to execute the following command:podman login --authfile ~/.docker/config.json quay-server.example.com
$ podman login --authfile ~/.docker/config.json quay-server.example.com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Username: Password: Login Succeeded!
Username: Password: Login Succeeded!
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the following command to see the updated authorization configuration:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.4. Installing and using Cosign Copy linkLink copied to clipboard!
Use the following procedure to directly install Cosign.
Prerequisites
- You have installed Go version 1.16 or later.
-
You have set
FEATURE_GENERAL_OCI_SUPPORT
totrue
in yourconfig.yaml
file.
Procedure
Enter the following
go
command to directly install Cosign:go install github.com/sigstore/cosign/cmd/cosign@v1.0.0
$ go install github.com/sigstore/cosign/cmd/cosign@v1.0.0
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
go: downloading github.com/sigstore/cosign v1.0.0 go: downloading github.com/peterbourgon/ff/v3 v3.1.0
go: downloading github.com/sigstore/cosign v1.0.0 go: downloading github.com/peterbourgon/ff/v3 v3.1.0
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Generate a key-value pair for Cosign by entering the following command:
cosign generate-key-pair
$ cosign generate-key-pair
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Enter password for private key: Enter again: Private key written to cosign.key Public key written to cosign.pub
Enter password for private key: Enter again: Private key written to cosign.key Public key written to cosign.pub
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sign the key-value pair by entering the following command:
cosign sign -key cosign.key quay-server.example.com/user1/busybox:test
$ cosign sign -key cosign.key quay-server.example.com/user1/busybox:test
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Enter password for private key: Pushing signature to: quay-server.example.com/user1/busybox:sha256-ff13b8f6f289b92ec2913fa57c5dd0a874c3a7f8f149aabee50e3d01546473e3.sig
Enter password for private key: Pushing signature to: quay-server.example.com/user1/busybox:sha256-ff13b8f6f289b92ec2913fa57c5dd0a874c3a7f8f149aabee50e3d01546473e3.sig
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you experience the
error: signing quay-server.example.com/user1/busybox:test: getting remote image: GET https://quay-server.example.com/v2/user1/busybox/manifests/test: UNAUTHORIZED: access to the requested resource is not authorized; map[]
error, which occurs because Cosign relies on~./docker/config.json
for authorization, you might need to execute the following command:podman login --authfile ~/.docker/config.json quay-server.example.com
$ podman login --authfile ~/.docker/config.json quay-server.example.com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Username: Password: Login Succeeded!
Username: Password: Login Succeeded!
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the following command to see the updated authorization configuration:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
10.5. Using other artifact types Copy linkLink copied to clipboard!
By default, other artifact types are enabled for use by Red Hat Quay.
Use the following procedure to add additional OCI media types.
Prerequisites
-
You have set
FEATURE_GENERAL_OCI_SUPPORT
totrue
in yourconfig.yaml
file.
Procedure
In your
config.yaml
file, add theALLOWED_OCI_ARTIFACT_TYPES
configuration field. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add support for your desired artifact type, for example, Singularity Image Format (SIF), by adding the following to your
config.yaml
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantWhen adding artifact types that are not configured by default, Red Hat Quay administrators will also need to manually add support for Cosign and Helm if desired.
Now, users can tag SIF images for their Red Hat Quay registry.
10.6. Disabling OCI artifacts in Red Hat Quay Copy linkLink copied to clipboard!
Use the following procedure to disable support for OCI artifacts.
Procedure
Disable OCI artifact support by setting
FEATURE_GENERAL_OCI_SUPPORT
tofalse
in yourconfig.yaml
file. For example:FEATURE_GENERAL_OCI_SUPPORT = false
FEATURE_GENERAL_OCI_SUPPORT = false
Copy to Clipboard Copied! Toggle word wrap Toggle overflow