Skip to content

feat: Add distribution Docker Engine API#102

Merged
HofmeisterAn merged 9 commits intotestcontainers:mainfrom
bbartels:main
Apr 29, 2026
Merged

feat: Add distribution Docker Engine API#102
HofmeisterAn merged 9 commits intotestcontainers:mainfrom
bbartels:main

Conversation

@bbartels
Copy link
Copy Markdown

Docker.DotNet did not expose the Docker Engine GET /distribution/{name}/json endpoint, so callers could not inspect registry-backed image metadata without pulling the image first. This change adds a minimal Distribution API surface on IDockerClient for remote descriptor/platform inspection.

  • API surface

    • Adds IDistributionOperations with InspectAsync(string name, CancellationToken)
    • Wires Distribution into IDockerClient and DockerClient
  • Endpoint implementation

    • Adds DistributionOperations to call distribution/{name}/json
    • Maps 404 responses to DockerImageNotFoundException
    • Follows the existing endpoint pattern used across the client
  • Model support

    • Adds DistributionInspectResponse using the existing Descriptor and Platform models
    • Registers the new response type with the source-generated JSON serializer context
  • Tests

    • Adds coverage for:
      • successful inspect of alpine:3.20
      • missing manifest/image handling
      • null/empty image name validation
var response = await dockerClient.Distribution.InspectAsync("alpine:3.20", cancellationToken);

var digest = response.Descriptor.Digest;
var platforms = response.Platforms;

Copilot AI and others added 5 commits April 28, 2026 14:19
Agent-Logs-Url: https://github.com/bbartels/Docker.DotNet/sessions/291566e2-fea2-4eb9-acb2-377176972eb0

Co-authored-by: bbartels <23058572+bbartels@users.noreply.github.com>
Agent-Logs-Url: https://github.com/bbartels/Docker.DotNet/sessions/291566e2-fea2-4eb9-acb2-377176972eb0

Co-authored-by: bbartels <23058572+bbartels@users.noreply.github.com>
Agent-Logs-Url: https://github.com/bbartels/Docker.DotNet/sessions/291566e2-fea2-4eb9-acb2-377176972eb0

Co-authored-by: bbartels <23058572+bbartels@users.noreply.github.com>
…async

Add distribution inspect operations to Docker.DotNet
@bbartels
Copy link
Copy Markdown
Author

@HofmeisterAn I've been trying to use the distribution api, but wasn't available via the SDK. This PR implements calling out to that api

@campersau
Copy link
Copy Markdown

Looks like the generated code was modified by hand.

You could add the distribution inspect types from here:
https://github.com/moby/moby/blob/a2d62b318ead6553cb591d592aa198808ded3d0b/client/distribution_inspect.go#L13 or
https://github.com/moby/moby/blob/a2d62b318ead6553cb591d592aa198808ded3d0b/api/types/registry/registry.go#L60

into https://github.com/testcontainers/Docker.DotNet/blob/main/tools/specgen/specgen.go

and then regenerated the code.

Copilot AI and others added 3 commits April 28, 2026 16:03
Agent-Logs-Url: https://github.com/bbartels/Docker.DotNet/sessions/15862762-6b54-4094-a000-63d1c9d81798

Co-authored-by: bbartels <23058572+bbartels@users.noreply.github.com>
Agent-Logs-Url: https://github.com/bbartels/Docker.DotNet/sessions/15862762-6b54-4094-a000-63d1c9d81798

Co-authored-by: bbartels <23058572+bbartels@users.noreply.github.com>
…types

Generate `DistributionInspectResponse` from specgen
@bbartels
Copy link
Copy Markdown
Author

@HofmeisterAn HofmeisterAn changed the title Add distribution inspect operations to Docker.DotNet feat: Add distribution Docker Engine API Apr 29, 2026
@HofmeisterAn HofmeisterAn added the enhancement New feature or request label Apr 29, 2026
Copy link
Copy Markdown
Collaborator

@HofmeisterAn HofmeisterAn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@HofmeisterAn HofmeisterAn merged commit 3a67084 into testcontainers:main Apr 29, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants