oc mirror fails with error "invalid mirror sequence order"
Environment
- Red Hat OpenShift Container Platform (RHOCP)
- 4.11 or later
- oc mirror plugin
Issue
-
Mirrored several images to a local directory using the oc mirror command.
$ oc mirror --config=./imageset-config.yaml file://mirror/data [repeat several times..] $ ls mirror/data mirror_seq1_000000.tar mirror_seq2_000000.tar mirror_seq3_000000.tar oc-mirror-workspace -
When mirroring the tar files mirrored locally to the registry using the oc mirror command, the following error is output.
$ oc mirror --from=./mirror/datamirror_seq3_000000.tar docker://mirror.example.com:8443 Checking push permissions for mirror.eample.com:8443 Publishing image set from archive "./mirror_seq3_000000.tar" to registry "mirror.example.com:8443" error: error during publishing, expecting imageset with prefix mirror_seq1: invalid mirror sequence order, want 1, got 3 -
How to mirror the tar files mirrored locally to the registry?
Resolution
-
Mirror the tar files mirrored locally in sequence number order.
-
Alternatively, distinguish metadata for each image file retained locally, re-mirror them locally, and then push that file to the mirror registry.
$ cat imageset-config.yaml apiVersion: mirror.openshift.io/v1alpha2 kind: ImageSetConfiguration storageConfig: local: path: /home/mirror/local/meta-data #<---- mirror: platform: channels: - name: stable-4.12 minVersion: 4.12.22 maxVersion: 4.12.22 shortestPath: true type: ocp
Root Cause
- oc mirror assigns sequence numbers to the mirrored image files and retains them in metadata. To maintain the consistency of mirroring, it is necessary to push to the registry in sequence number order.
- If you want to manage the mirroring files (tar files) separately for each image (for example, OCP release images and Operator images), you can avoid this error by dividing the metadata for each image, so that the sequence number for each file becomes 1.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.