// Module included in the following assemblies:
//
// * openshift_images/image-configuration-hcp.adoc

:_mod-docs-content-type: PROCEDURE
[id="images-registry-mirroring-create_{context}"]
= Creating an image mirror configuration

[role="_abstract"]
You can create an image mirror configuration for a {product-title} cluster with the {rosa-cli-first} tool.

[IMPORTANT]
====
The source registry cannot be modified after creation. You must delete and re-create the image mirror to change the source.
====

.Procedure

* Run the following command to create an image mirror configuration:
+
[source,terminal]
----
$ rosa create image-mirror [arguments]
----
+
.Arguments
[cols="30,70"]
|===
|Option |Definition

a|--cluster
|Required: The name or ID of the cluster the mirror configuration will be applied to.

|--source
|Required: The source registry that will be mirrored.

|--mirrors
|Required: List of mirror registries. Mirror registries must be comma-separated.

|--type=digest
|Optional: Type of image mirror. The `digest` type is set by default and the only available `type` option.

|--profile
|Optional: Specifies an AWS profile (string) from your credentials file.

|--region
|Optional:Specifies an AWS region, overriding the AWS_REGION environment variable.
|===
+
.Examples
Creates an image mirror configuration for a cluster named `mycluster`.
+
[source,terminal]
----
$ rosa create image-mirror --cluster=mycluster \
  --source=registry.example.com/team \
  --mirrors=mirror.corp.com/team,backup.corp.com/team
----
+
.Example Output
[source,terminal]
----
I: Image mirror with ID 'abc123def456' has been created on cluster 'mycluster'
I: Source: registry.example.com/team
I: Mirrors: [mirror.corp.com/team backup.corp.com/team]
----
+
[NOTE]
====
An ID is automatically generated and assigned to an image mirror during image mirror configuration creation.
====

* Run the following command to create an image mirror configuration with a specific type:
+
[source,terminal]
----
$ rosa create image-mirror --cluster=mycluster \
  --type=digest --source=docker.io/library \
  --mirrors=internal-registry.company.com/dockerhub
----
+
[NOTE]
====
The `digest` type is set by default and the only available `type` option.
====

* Run the following command to create a single image mirror configuration with multiple mirrors for a cluster:
+
[source,terminal]
----
$ rosa create image-mirror --cluster=mycluster \
  --source=quay.io/openshift \
  --mirrors=mirror1.company.com/openshift,mirror2.company.com/openshift,mirror3.company.com/openshift
----
