feat: add OCI multi-registry support (ghcr.io, quay.io, mcr.microsoft.com, etc.) - #7
Open
EpicTGuy wants to merge 1 commit into
Open
feat: add OCI multi-registry support (ghcr.io, quay.io, mcr.microsoft.com, etc.)#7EpicTGuy wants to merge 1 commit into
EpicTGuy wants to merge 1 commit into
Conversation
The script was previously hardcoded for Docker Hub only. This patch adds support for any OCI Distribution Spec compliant registry by dynamically discovering the auth endpoint via the WWW-Authenticate header returned on a 401 response. Changes: - Detect registry prefix from image spec (hostname containing a dot) - For non-Docker Hub registries: probe /v2/ to discover Bearer auth realm and service via WWW-Authenticate header - Handle registries that require no auth (e.g. mcr.microsoft.com returns 200 on /v2/ with no WWW-Authenticate) - Support both OCI image index (vnd.oci.image.index.v1+json) and Docker manifest list (vnd.docker.distribution.manifest.list.v2+json) for multi-arch platform resolution - Use GET instead of HEAD for /v2/ probe (some registries return 405 on HEAD) - Keep Docker Hub flow (hub.docker.com API) fully intact for backward compat Tested against: docker.io, ghcr.io, quay.io, registry.gitlab.com, mcr.microsoft.com Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
EpicTGuy
pushed a commit
to EpicTGuy/AFFiNE_ynh
that referenced
this pull request
Apr 22, 2026
AFFiNE's server image is hosted on ghcr.io, which requires OCI Bearer auth not supported by the vendored docker-image-extract in YunoHost 12.1.x. Embeds the patched script from jjlin/docker-image-extract#7 as a workaround until YunoHost/yunohost#2293 is merged. Applied in both install and upgrade. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The script was previously hardcoded for Docker Hub only. This PR adds support for any OCI Distribution Spec compliant registry by dynamically discovering the auth endpoint via the
WWW-Authenticateheader returned on a 401 response.Tested against:
docker.io,ghcr.io,quay.io,registry.gitlab.com,mcr.microsoft.com.Changes
Script
ghcr.io/user/image), it is treated as a registry hostnameGET /v2/to capture theWWW-Authenticateheader, then parserealmandserviceto build the token URL/v2/returns 200 with noWWW-Authenticate(e.g.mcr.microsoft.com), proceed without a tokenapplication/vnd.oci.image.index.v1+jsonandapplication/vnd.docker.distribution.manifest.list.v2+jsonfor platform resolutionhub.docker.comAPI +auth.docker.io) is fully preservedREADME
Implementation notes
GETinstead ofHEADfor the/v2/probe — some registries (e.g.ghcr.io) return 405 onHEADtr -d '"[:space:]"'before parsing the manifest list JSON — registries may return pretty-printed JSON; spaces break thegrep/sedpipeline (safe because OCI manifest list string values never contain spaces)head -1fromextract '"mediaType"'to avoid matching nested entries in the manifests arrayTest results
hello-world:latestalpine:3.18toeverything/affine:stabletoeverything/affine:sha256:44c65e...prometheus/prometheus:latestgitlab-org/gitlab-runner:latesthello-world