|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * installing/disconnected_install/installing-mirroring-disconnected.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="oc-mirror-oci-format_{context}"] |
| 7 | += Mirroring Operator images in OCI format |
| 8 | + |
| 9 | +You can use the oc-mirror plug-in to mirror Operators in the Open Container Initiative (OCI) image format, instead of Docker v2 format. You can copy Operator images to a file-based catalog on disk in OCI format. Then you can copy local OCI images to your target mirror registry. |
| 10 | + |
| 11 | +:FeatureName: Using the oc-mirror plug-in to mirror Operator images in OCI format |
| 12 | +include::snippets/technology-preview.adoc[] |
| 13 | + |
| 14 | +.Prerequisites |
| 15 | + |
| 16 | +* You have access to the internet to obtain the necessary container images. |
| 17 | +* You have installed the OpenShift CLI (`oc`). |
| 18 | +* You have installed the `oc-mirror` CLI plug-in. |
| 19 | +
|
| 20 | +.Procedure |
| 21 | + |
| 22 | +. Create the image set configuration file to retrieve the catalogs and images that you require. |
| 23 | ++ |
| 24 | +.Example image set configuration file for copying to disk |
| 25 | +[source,yaml] |
| 26 | +---- |
| 27 | +kind: ImageSetConfiguration |
| 28 | +apiVersion: mirror.openshift.io/v1alpha2 |
| 29 | +mirror: |
| 30 | + operators: |
| 31 | + - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.12 |
| 32 | + packages: |
| 33 | + - name: aws-load-balancer-operator |
| 34 | +---- |
| 35 | ++ |
| 36 | +[NOTE] |
| 37 | +==== |
| 38 | +When using the OCI feature, only the `mirror.operators.catalog` setting is available for use. |
| 39 | +
|
| 40 | +The `storageConfig` setting is ignored in favor of the location passed in to the `oc mirror` command. |
| 41 | +==== |
| 42 | + |
| 43 | +. Run the `oc mirror` command to mirror the images from the specified image set configuration to disk: |
| 44 | ++ |
| 45 | +[source,terminal] |
| 46 | +---- |
| 47 | +$ oc mirror --config=./imageset-config.yaml \ <1> |
| 48 | + --use-oci-feature \ <2> |
| 49 | + --oci-feature-action=copy \ <3> |
| 50 | + oci:///home/user/oc-mirror/my-oci-catalog <4> |
| 51 | +---- |
| 52 | +<1> Pass in the image set configuration file. This procedure assumes that it is named `imageset-config.yaml`. |
| 53 | +<2> Use the `--use-oci-feature` flag to enable the OCI feature. |
| 54 | +<3> To copy the catalog to disk, set the `--oci-feature-action` flag to `copy`. |
| 55 | +<4> Specify the full path to a directory on disk where you want to output the catalog. The path must start with `oci://`. This procedure assumes that the directory is named `my-oci-catalog`. |
| 56 | ++ |
| 57 | +[NOTE] |
| 58 | +==== |
| 59 | +You can optionally use the `--oci-registries-config` flag to specify the path to a TOML-formatted `registries.conf` file. You can use this to mirror from a different registry, such as a pre-production location for testing, without having to change the image set configuration file. |
| 60 | + |
| 61 | +.Example registries.conf file |
| 62 | +[source,toml] |
| 63 | +---- |
| 64 | +[[registry]] |
| 65 | + location = "registry.redhat.io:5000" |
| 66 | + insecure = false |
| 67 | + blocked = false |
| 68 | + mirror-by-digest-only = true |
| 69 | + prefix = "" |
| 70 | + [[registry.mirror]] |
| 71 | + location = "preprod-registry.example.com" |
| 72 | + insecure = false |
| 73 | +---- |
| 74 | + |
| 75 | +Set the `location` field in the `registry.mirror` section to an alternative registry location that you want to pull images from. The `location` field in the `registry` section must be the same registry location as the one you specify in the image set configuration file. |
| 76 | +==== |
| 77 | + |
| 78 | +. List your directory contents and verify that the following directories were created: |
| 79 | ++ |
| 80 | +[source,terminal] |
| 81 | +---- |
| 82 | +$ ls -l |
| 83 | +---- |
| 84 | ++ |
| 85 | +.Example output |
| 86 | +[source,terminal] |
| 87 | +---- |
| 88 | +my-oci-catalog <1> |
| 89 | +oc-mirror-workspace <2> |
| 90 | +olm_artifacts <3> |
| 91 | +---- |
| 92 | +<1> Directory that contains the OCI catalog. This procedure assumes that it is named `my-oci-catalog`. |
| 93 | +<2> Directory that contains each image in the catalog in its original format. |
| 94 | +<3> Directory that contains the files that describe the Operator bundles that this catalog references. |
| 95 | + |
| 96 | +. Update the image set configuration file to specify the location of the catalog on disk to mirror to the target mirror registry: |
| 97 | ++ |
| 98 | +.Example image set configuration file for mirroring to mirror registry |
| 99 | +[source,yaml] |
| 100 | +---- |
| 101 | +kind: ImageSetConfiguration |
| 102 | +apiVersion: mirror.openshift.io/v1alpha2 |
| 103 | +mirror: |
| 104 | + operators: |
| 105 | + - catalog: oci:///home/user/oc-mirror/my-oci-catalog/redhat-operator-index <1> |
| 106 | + packages: |
| 107 | + - name: aws-load-balancer-operator |
| 108 | +---- |
| 109 | +<1> Specify the absolute path to the location of the OCI catalog on disk. This procedure assumes that you used `my-oci-catalog` as the directory and mirrored the `redhat-operator-index` catalog. The path must start with `oci://`. |
| 110 | + |
| 111 | +. Run the oc mirror command to process the image set file on disk and mirror the contents to a target mirror registry: |
| 112 | ++ |
| 113 | +[source,terminal] |
| 114 | +---- |
| 115 | +$ oc mirror --config=./imageset-config.yaml \ <1> |
| 116 | + --use-oci-feature \ <2> |
| 117 | + --oci-feature-action=mirror \ <3> |
| 118 | + docker://registry.example:5000 <4> |
| 119 | +---- |
| 120 | +<1> Pass in the updated image set configuration file. This procedure assumes that it is named `imageset-config.yaml`. |
| 121 | +<2> Use the `--use-oci-feature` flag to enable the OCI feature. |
| 122 | +<3> To mirror the catalog to the target mirror registry, set the `--oci-feature-action` flag to `mirror`. |
| 123 | +<4> Specify the registry to mirror the image set file to. The registry must start with `docker://`. If you specify a top-level namespace for the mirror registry, you must also use this same namespace on subsequent executions. |
| 124 | ++ |
| 125 | +[NOTE] |
| 126 | +==== |
| 127 | +You can optionally use the `--oci-insecure-signature-policy` flag to not push signatures to the target mirror registry. |
| 128 | +==== |
0 commit comments