Skip to content

Devcontainers features publish cannot handle registries with url path #1098

@MattiasDC

Description

@MattiasDC

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

const registry = splitOnSlash[0];
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.

if (dockerConfig.auths && dockerConfig.auths[registry]) {

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'

Metadata

Metadata

Assignees

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