Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 10. Using Red Hat subscriptions in builds
Use the following sections to run entitled builds on OpenShift Container Platform.
10.1. Creating an image stream tag for the Red Hat Universal Base Image Link kopierenLink in die Zwischenablage kopiert!
To use Red Hat subscriptions within a build, you create an image stream tag to reference the Universal Base Image (UBI).
To make the UBI available in every project in the cluster, you add the image stream tag to the
openshift
The benefit of using image stream tags this way is that doing so grants access to the UBI based on the
registry.redhat.io
registry.redhat.io
Procedure
To create an
in theImageStreamTagnamespace, so it is available to developers in all projects, enter:openshift$ oc tag --source=docker registry.redhat.io/ubi8/ubi:latest ubi:latest -n openshiftTipYou can alternatively apply the following YAML to create an
in theImageStreamTagnamespace:openshiftapiVersion: image.openshift.io/v1 kind: ImageStream metadata: name: ubi namespace: openshift spec: tags: - from: kind: DockerImage name: registry.redhat.io/ubi8/ubi:latest name: latest referencePolicy: type: SourceTo create an
in a single project, enter:ImageStreamTag$ oc tag --source=docker registry.redhat.io/ubi8/ubi:latest ubi:latestTipYou can alternatively apply the following YAML to create an
in a single project:ImageStreamTagapiVersion: image.openshift.io/v1 kind: ImageStream metadata: name: ubi spec: tags: - from: kind: DockerImage name: registry.redhat.io/ubi8/ubi:latest name: latest referencePolicy: type: Source
10.2. Adding subscription entitlements as a build secret Link kopierenLink in die Zwischenablage kopiert!
Builds that use Red Hat subscriptions to install content must include the entitlement keys as a build secret.
Prerequisites
You must have access to Red Hat entitlements through your subscription. The entitlement secret is automatically created by the Insights Operator.
When you perform an Entitlement Build using Red Hat Enterprise Linux (RHEL) 7, you must have the following instructions in your Dockerfile before you run any
yum
RUN rm /etc/rhsm-host
Procedure
Add the etc-pki-entitlement secret as a build volume in the build configuration’s Docker strategy:
strategy: dockerStrategy: from: kind: ImageStreamTag name: ubi:latest volumes: - name: etc-pki-entitlement mounts: - destinationPath: /etc/pki/entitlement source: type: Secret secret: secretName: etc-pki-entitlement
10.3. Running builds with Subscription Manager Link kopierenLink in die Zwischenablage kopiert!
10.3.1. Docker builds using Subscription Manager Link kopierenLink in die Zwischenablage kopiert!
Docker strategy builds can use the Subscription Manager to install subscription content.
Prerequisites
The entitlement keys must be added as build strategy volumes.
Procedure
Use the following as an example Dockerfile to install content with the Subscription Manager:
FROM registry.redhat.io/ubi8/ubi:latest
RUN dnf search kernel-devel --showduplicates && \
dnf install -y kernel-devel
10.4. Running builds with Red Hat Satellite subscriptions Link kopierenLink in die Zwischenablage kopiert!
10.4.1. Adding Red Hat Satellite configurations to builds Link kopierenLink in die Zwischenablage kopiert!
Builds that use Red Hat Satellite to install content must provide appropriate configurations to obtain content from Satellite repositories.
Prerequisites
You must provide or create a
-compatible repository configuration file that downloads content from your Satellite instance.yumSample repository configuration
[test-<name>] name=test-<number> baseurl = https://satellite.../content/dist/rhel/server/7/7Server/x86_64/os enabled=1 gpgcheck=0 sslverify=0 sslclientkey = /etc/pki/entitlement/...-key.pem sslclientcert = /etc/pki/entitlement/....pem
Procedure
Create a
containing the Satellite repository configuration file:ConfigMap$ oc create configmap yum-repos-d --from-file /path/to/satellite.repoAdd the Satellite repository configuration and entitlement key as a build volumes:
strategy: dockerStrategy: from: kind: ImageStreamTag name: ubi:latest volumes: - name: yum-repos-d mounts: - destinationPath: /etc/yum.repos.d source: type: ConfigMap configMap: name: yum-repos-d - name: etc-pki-entitlement mounts: - destinationPath: /etc/pki/entitlement source: type: Secret secret: secretName: etc-pki-entitlement
10.4.2. Docker builds using Red Hat Satellite subscriptions Link kopierenLink in die Zwischenablage kopiert!
Docker strategy builds can use Red Hat Satellite repositories to install subscription content.
Prerequisites
- You have added the entitlement keys and Satellite repository configurations as build volumes.
Procedure
Use the following as an example Dockerfile to install content with Satellite:
FROM registry.redhat.io/ubi8/ubi:latest
RUN dnf search kernel-devel --showduplicates && \
dnf install -y kernel-devel