Add Docker API version negotiation to fix daemon compatibility#110
Merged
Add Docker API version negotiation to fix daemon compatibility#110
Conversation
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix DynamoDB image pull error due to client version
Add Docker API version negotiation to fix daemon compatibility
Feb 7, 2026
alexec
approved these changes
Feb 9, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Docker client API version negotiation when instantiating Docker clients, aiming to improve compatibility across Docker daemon versions.
Changes:
- Enable API version negotiation in
internal/proc/container.goDocker client creation (Run and stop paths) - Enable API version negotiation in
hack/examples.goDocker client creation (example updater)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/proc/container.go | Adds client.WithAPIVersionNegotiation() when creating Docker clients used for container lifecycle operations. |
| hack/examples.go | Adds client.WithAPIVersionNegotiation() when creating Docker client used to pull/inspect images for docs/examples generation. |
Comments suppressed due to low confidence (3)
internal/proc/container.go:53
WithAPIVersionNegotiation()only negotiates downward (it can downgrade to an older daemon API), and will not increase the client API version above what this build supports. Since the repo is currently pinned togithub.com/docker/docker v24.0.9(API v1.43), this change alone will still send v1.43 and will continue to fail against daemons whose minimum supported API is v1.44+. To fix the reported error, bump the Docker client dependency to a version that supports API v1.44+ (and keep negotiation for backward compatibility), or explicitly set a higher API version (with the tradeoff of dropping older-daemon support).
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
return fmt.Errorf("failed to create docker client: %w", err)
}
defer cli.Close()
internal/proc/container.go:260
- Same as above: API version negotiation won’t help if the compiled Docker client max/default API is still v1.43. With
github.com/docker/docker v24.x, this will still fail against daemons requiring v1.44+. Consider updating the dependency to v25+ (and keep negotiation) soContainerStopcan succeed on newer daemons.
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
return fmt.Errorf("failed to create docker client: %w", err)
}
defer cli.Close()
hack/examples.go:91
WithAPIVersionNegotiation()only allows the client to downgrade to match older daemons; it won’t upgrade a v24.x Docker client (API v1.43) to talk to daemons requiring v1.44+. If this hack script needs to run against newer Docker Engine versions, the underlyinggithub.com/docker/dockerdependency needs to be bumped to a release that supports API v1.44+ (negotiation can remain enabled for backward compatibility).
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
return fmt.Errorf("failed to create client: %w", err)
}
defer cli.Close()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Docker client was hardcoded to API v1.43, causing failures with daemons requiring v1.44+:
Changes
Added
client.WithAPIVersionNegotiation()to all Docker client instantiations:internal/proc/container.go- Run() and stop() methodshack/examples.go- updateExample() functionClient now auto-negotiates API version on first request, maintaining compatibility with both older and newer Docker daemons.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.