Skip to content

oc-mirror panics when REGISTRY_AUTH_FILE environment variable is set #1453

Description

@eb4x

oc-mirror v2 panics on startup when the REGISTRY_AUTH_FILE environment variable is set, which is common on Podman-based systems.

The distribution/distribution library's configuration.Parse() scans all environment variables prefixed with REGISTRY_ and attempts to unmarshal their values as YAML configuration overrides. REGISTRY_AUTH_FILE is a standard Podman/containers convention pointing to an auth.json file path, not a distribution registry config parameter. The file path string fails YAML unmarshalling, producing a broken config that causes a panic.

Steps to reproduce:

export REGISTRY_AUTH_FILE=~/.config/containers/auth.json
oc-mirror --v2 --config ./isc.yaml --workspace file:///tmp/workspace docker://registry.example.com/mirror

Expected:
oc-mirror runs normally, using REGISTRY_AUTH_FILE for authentication.

Actual:

  [ERROR]  : parsing config error parsing local storage configuration : parsing environment variable REGISTRY_AUTH_FILE: yaml: unmarshal errors:
    line 1: cannot unmarshal !!str `/home/u...` into configuration.Parameters
  panic: StorageDriver not registered:

  goroutine 1 [running]:
  github.com/distribution/distribution/v3/registry/handlers.NewApp(...)
          .../registry/handlers/app.go:131
  ...
  github.com/openshift/oc-mirror/v2/internal/pkg/cli.(*ExecutorSchema).setupLocalStorage(...)
          .../internal/pkg/cli/executor.go:731

Workaround:
unset REGISTRY_AUTH_FILE before running oc-mirror, and pass --authfile explicitly instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions