cli icon indicating copy to clipboard operation
cli copied to clipboard

`Devcontainers features publish` cannot handle registries with url path

Open MattiasDC opened this issue 2 months ago • 1 comments

When trying to publish my feature to my registry at 'my-registry.com/features-feed', devcontainers searches only for 'my-registry.com' matches in the $DOCKER_CONFIG/config.json file for registry matches, causing authentication to fail.

For example my publish command is: devcontainer features publish src -r my-registry.com.com/features-feed -n devcontainers/features --log-level trace:

and my $DOCKER_CONFIG/config.json contains the following content (redacted): {"auths": { "my-registry.com/features-feed": {"auth": "***", "email": "" } }} Then devcontainer will in the https://github.com/devcontainers/cli/blob/ac2d5b7aeaf0eff69c25ba923609013b28ed67c2/src/spec-configuration/containerCollectionsOCI.ts#L213 always split on the first /, while in the publish command I specified that my registry is at my-registry.com/features-feed.

Devcontainers will try to authenticate by searching the shortened url in the docker config, which doesn't contain the registry, but the full registry url instead. https://github.com/devcontainers/cli/blob/ac2d5b7aeaf0eff69c25ba923609013b28ed67c2/src/spec-configuration/httpOCIRegistry.ts#L239

Example trace output:

[2025-10-31T16:16:10.934Z] Packaging feature collection...
[2025-10-31T16:16:10.936Z] Processing feature: python-development...
[2025-10-31T16:16:11.048Z] Packaged 1 features!
[2025-10-31T16:16:11.048Z] Processing feature: python-development...
[2025-10-31T16:16:11.049Z] > input: my-registry.com/features-feed/devcontainers/features/python-development
[2025-10-31T16:16:11.049Z] >
[2025-10-31T16:16:11.049Z] > resource: my-registry.com/features-feed/devcontainers/features/python-development
[2025-10-31T16:16:11.049Z] > id: python-development
[2025-10-31T16:16:11.049Z] > owner: features-feed
[2025-10-31T16:16:11.049Z] > namespace: features-feed/devcontainers/features
[2025-10-31T16:16:11.049Z] > registry: my-registry.com
[2025-10-31T16:16:11.049Z] > path: features-feed/devcontainers/features/python-development
[2025-10-31T16:16:11.049Z] >
[2025-10-31T16:16:11.049Z] > version: latest
[2025-10-31T16:16:11.049Z] > tag?: latest
[2025-10-31T16:16:11.049Z] > digest?: undefined
[2025-10-31T16:16:11.049Z] Feature Annotations: {"dev.containers.metadata":"{\"name\":\"Python Development\",\"id\":\"python-development\",\"version\":\"0.0.1\"}"}
[2025-10-31T16:16:11.049Z] Fetching published versions...
[2025-10-31T16:16:11.261Z] [httpOci] Attempting to authenticate via 'Bearer' auth.
[2025-10-31T16:16:11.263Z] [httpOci] Environment DOCKER_CONFIG is set to '/home/agent/_work/_temp/DockerConfig'
[2025-10-31T16:16:11.268Z] [httpOci] No authentication credentials found for registry 'my-registry.com' via docker config or credential helper.
[2025-10-31T16:16:11.268Z] [httpOci] No authentication credentials found for registry 'my-registry.com'. Accessing anonymously.
[2025-10-31T16:16:11.268Z] [httpOci] Attempting to fetch bearer token from:  https://my-registry.com/v2/_auth?service=my-registry.com&scope=repository:features-feed/devcontainers/features/python-development:pull
[2025-10-31T16:16:11.340Z] [httpOci] 403 on reattempt after auth: https://my-registry.com/v2/features-feed/devcontainers/features/python-development/tags/list
[2025-10-31T16:16:11.341Z] (!) ERR: Could not fetch published tags for 'features-feed/devcontainers/features/python-development' : {"errors":[{"code":"DENIED","message":"Anonymous is not permitted for the current scope.","detail":[]}]} 
[2025-10-31T16:16:11.341Z] (!) ERR: Failed to publish 'my-registry.com/features-feed/devcontainers/features/python-development'

MattiasDC avatar Oct 31 '25 16:10 MattiasDC

*docker **anch' io credo che la piattaforma non funziona ho sta funzionando male, mi arrivano continue notifica non so se sia il repositore "

UMBERTODECICCO75 avatar Nov 13 '25 01:11 UMBERTODECICCO75