Perform a dry run

You can use oc-mirror to perform a dry run so that you can review the list of images to be mirrored. By using a dry run, you can catch any errors with your image set configuration early or use the generated list of images with other tools to conduct mirroring.

Prerequisites
  • You have access to the internet to obtain the necessary container images.

  • You installed the OpenShift CLI (oc).

  • You installed the oc-mirror CLI plugin.

  • You created the image set configuration file.

Procedure
  1. Run the oc mirror command with the --dry-run flag to perform a dry run:

    $ oc-mirror --config <ImageSetConfig.yaml> docker://localhost:5000 --workspace file://<outm2m> --dry-run --v2

    where:

    ImageSetConfig.yaml

    Specifies the name of the image set configuration file that you created.

    docker://localhost:5000

    Specifies the mirror registry. Nothing is mirrored to this registry when you use the --dry-run flag.

    --workspace file://<outm2m>

    Insert the address of the workspace path.

    --dry-run

    The dry run flag generates the dry run artifacts and not an actual image set file.

    --v2

    Specifies oc mirror v2.

    Example output
    2025/08/25 15:50:44  [INFO]   : 👋 Hello, welcome to oc-mirror
    2025/08/25 15:50:44  [INFO]   : ⚙  setting up the environment for you...
    2025/08/25 15:50:44  [INFO]   : 🔀 workflow mode: mirrorToMirror
    2025/08/25 15:50:44  [INFO]   : 🕵  going to discover the necessary images...
    2025/08/25 15:50:44  [INFO]   : 🔍 collecting release images...
    2025/08/25 15:50:44  [INFO]   : 🔍 collecting operator images...
     ✓   (1m30s) Collecting catalog registry.redhat.io/redhat/redhat-operator-index:v4.20
    2025/08/25 15:52:14  [INFO]   : 🔍 collecting additional images...
    2025/08/25 15:52:14  [INFO]   : 📄 list of all images for mirroring in : wspace/working-dir/dry-run/mapping.txt
    2025/08/25 15:52:14  [INFO]   : mirror time     : 1m30.399585837s
    2025/08/25 15:52:14  [INFO]   : 👋 Goodbye, thank you for using oc-mirror
  2. Review the mapping.txt file that was generated by running the following command:

    $ cat wspace/working-dir/dry-run/mapping.txt
    Example output
    docker://registry.redhat.io/amq8/amq-broker-rhel9@sha256:47fd4ce2533496828aba37bd1f9715e2164d5c90bd0fc6b25e7e0786d723bf01=docker://mirror.com/amq8/amq-broker-rhel9:sha256-47fd4ce2533496828aba37bd1f9715e2164d5c90bd0fc6b25e7e0786d723bf01
    docker://registry.redhat.io/amq8/amq-broker-init-rhel9@sha256:9cc48eecf1442ae04b8543fa5d4381a13bc2831390850828834d387006d1342b=docker://mirror.com/amq7/amq-broker-init-rhel9:sha256-9cc48eecf1442ae04b8543fa5d4381a13bc2831390850828834d387006d1342b
    docker://registry.redhat.io/amq8/amq-broker-rhel9@sha256:bb6fbd68475a7852b4d99eea6c4ab313f9267da7963162f0d75375d7063409e7=docker://mirror.com/amq8/amq-broker-rhel9:sha256-bb6fbd68475a7852b4d99eea6c4ab313f9267da7963162f0d75375d7063409e7
    docker://registry.redhat.io/amq8/amq-broker-rhel9@sha256:d42d713da0ce6806fdc6492b6342586783e6865a82a8647d3c4288439b1751ee=docker://mirror.com/amq8/amq-broker-rhel9:sha256-d42d713da0ce6806fdc6492b6342586783e6865a82a8647d3c4288439b1751ee
    docker://registry.redhat.io/amq8/amq-broker-init-rhel9@sha256:ffffa9875f0379e9373f89f05eb06e5a193273bb04bc3aa5f85b044357b79098=docker://mirror.com/amq8/amq-broker-init-rhel9:sha256-ffffa9875f0379e9373f89f05eb06e5a193273bb04bc3aa5f85b044357b79098