feat(docker): use docker/go-sdk for daemon client#522
Conversation
Replace the hand-rolled docker daemon client in pkg/docker/client.go with the high-level github.com/docker/go-sdk client (v0.1.0-alpha013). NewClient now delegates to sdkclient.New, which performs FromEnv configuration, API-version negotiation, and a daemon health check during construction, so the previous two-step (FromEnv then bare fallback) plus manual NegotiateAPIVersion logic is no longer needed. Client embeds sdkclient.SDKClient, which embeds the moby APIClient. The only daemon-API consumer is the internal BuildKit build strategy, which needs DialHijack/Close - both satisfied by the embedded client. The CLI-shellout helper, runtime detection, and compose code are untouched, so podman/nerdctl/buildx support is unaffected.
✅ Deploy Preview for devsydev canceled.
|
✅ Deploy Preview for images-devsy-sh canceled.
|
📝 WalkthroughWalkthroughMigrates the Docker client wrapper from ChangesDocker SDK Client Migration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
go.mod (1)
29-29: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winPinning a pre-release (
alpha) dependency on a daemon-facing path — track upgrades deliberately.
github.com/docker/go-sdk/clientis pre-v1; the maintainers note the public API may change between releases untilv1.0.0. Pinning to the exactv0.1.0-alpha013tag (as done here) is the right mitigation, but plan to watch the changelog and re-validate theSDKClient/DialHijackcontract on each bump, since signature changes here directly affect the BuildKit build path. Worth a brief note in the PR/migration docs that this seam depends on an alpha SDK.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@go.mod` at line 29, The dependency on github.com/docker/go-sdk/client is intentionally pinned to the alpha release, so update the PR/migration notes to call out that this is a pre-v1, daemon-facing seam that must be tracked deliberately. Mention the BuildKit path and the SDKClient/DialHijack contract by name, and add guidance that each version bump should be re-validated against the changelog before merging.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@go.mod`:
- Line 29: The dependency on github.com/docker/go-sdk/client is intentionally
pinned to the alpha release, so update the PR/migration notes to call out that
this is a pre-v1, daemon-facing seam that must be tracked deliberately. Mention
the BuildKit path and the SDKClient/DialHijack contract by name, and add
guidance that each version bump should be re-validated against the changelog
before merging.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 95a584b7-feb8-4275-8407-8a3688484375
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (2)
go.modpkg/docker/client.go
Summary
First incremental step toward adopting
github.com/docker/go-sdk. Replaces the hand-rolled Docker daemon client inpkg/docker/client.gowith the high-level go-sdk client (pinned tov0.1.0-alpha013).NewClientnow delegates tosdkclient.New, which performsFromEnvconfiguration, API-version negotiation, and a daemon health check during construction — subsuming the previous two-step (FromEnv → bare fallback) plus manualNegotiateAPIVersionlogic.Clientembedssdkclient.SDKClient(which embeds the mobyAPIClient).Scope & safety
This is deliberately the only daemon-API seam in the codebase. The single production consumer is the internal BuildKit build strategy (
pkg/driver/docker/build.go), which needsDialHijack/Close— both satisfied by the embedded client. The CLI-shellout helper, runtime detection, and compose code are untouched, so podman/nerdctl/buildx support is unaffected.Migrating the CLI-based paths (inspect/ps/run/pull) is intentionally out of scope: go-sdk is Docker-daemon-only, so those would need runtime gating to avoid regressing non-Docker runtimes.
Verification
go build ./...— cleango test ./pkg/docker/... ./pkg/driver/docker/...— passgolangci-lint run --new-from-rev=main pkg/docker/...— 0 issuesSummary by CodeRabbit
Bug Fixes
Chores