devcontainers / devcontainers/cli

`Devcontainers features publish` cannot handle registries with url path

Open
#1,098 1 comment 0 reactions 1 assignee Claimed by @v-Mathiyarasy View on GitHub
Dominant language
TypeScript
Stars
3k
Forks
457
Avg merge
13h 17m
Merged PRs (30d)
6

Description

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'
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.