oc-mirror in a disconnected environment fails with a "HTTP 401 Unauthorized" error

Solution Verified - Updated -

Issue

  • "oc-mirror" retrieves registry credentials from ~/.docker/config.json, that is inconvenient that a user is forced to add credentials to such a generic location for mirroring purposes. How can this path be defined in another way?
  • When trying to run the "oc-mirror" plugin without having a matching registry credential in one of ${HOME}/.docker/config.json or ${XDG_RUNTIME_DIR}/containers/auth.json paths against a private Container Image Registry a 401 Unauthorized error is returned:

    $ ./oc-mirror --config imageset-config.yaml file://archive
    Creating directory: archive/oc-mirror-workspace/src/publish
    Creating directory: archive/oc-mirror-workspace/src/v2
    Creating directory: archive/oc-mirror-workspace/src/charts
    Creating directory: archive/oc-mirror-workspace/src/release-signatures
    backend is not configured in imageset-config.yaml, using stateless mode
    backend is not configured in imageset-config.yaml, using stateless mode
    No metadata detected, creating new workspace
    level=info msg=trying next host error=failed to authorize: failed to fetch anonymous token: unexpected status: 401 Unauthorized host=registry.redhat.ioThe rendered catalog is invalid.Run "oc-mirror list operators --catalog CATALOG-NAME --package PACKAGE-NAME" for more information.error: error rendering new refs: render reference "registry.redhat.io/<any-namespace>/<image-name>:<image-tag>": error resolving name : failed to authorize: failed to fetch anonymous token: unexpected status: 401 Unauthorized
    the command terminates with HTTP401 Unauthorized which is something that we expect since there is no `config.json` file created.
    

Environment

  • Red Hat OpenShift Container Platform (RHOCP)
    • >= 4.9

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content