Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: always use API version negotiation when initializing clients #24237

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/24237.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
docker: Always negotiate API version when initializing clients
```
9 changes: 7 additions & 2 deletions drivers/docker/docklog/docker_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,18 @@ func (d *dockerLogger) getDockerClient(opts *StartOpts) (*client.Client, error)
d.logger.Debug("using TLS client connection to docker", "endpoint", opts.Endpoint)
newClient, err = client.NewClientWithOpts(
client.WithHost(opts.Endpoint),
client.WithTLSClientConfig(opts.TLSCA, opts.TLSCert, opts.TLSKey))
client.WithTLSClientConfig(opts.TLSCA, opts.TLSCert, opts.TLSKey),
client.WithAPIVersionNegotiation(),
)
if err != nil {
merr.Errors = append(merr.Errors, err)
}
} else {
d.logger.Debug("using plaintext client connection to docker", "endpoint", opts.Endpoint)
newClient, err = client.NewClientWithOpts(client.WithHost(opts.Endpoint))
newClient, err = client.NewClientWithOpts(
client.WithHost(opts.Endpoint),
client.WithAPIVersionNegotiation(),
)
if err != nil {
merr.Errors = append(merr.Errors, err)
}
Expand Down
6 changes: 5 additions & 1 deletion drivers/docker/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1927,13 +1927,17 @@ func (d *Driver) newDockerClient(timeout time.Duration) (*client.Client, error)
newClient, err = client.NewClientWithOpts(
client.WithHost(dockerEndpoint),
client.WithTLSClientConfig(ca, cert, key),
client.WithAPIVersionNegotiation(),
)
if err != nil {
merr.Errors = append(merr.Errors, err)
}
} else {
d.logger.Debug("using standard client connection", "endpoint", dockerEndpoint)
newClient, err = client.NewClientWithOpts(client.WithHost(dockerEndpoint))
newClient, err = client.NewClientWithOpts(
client.WithHost(dockerEndpoint),
client.WithAPIVersionNegotiation(),
)
if err != nil {
merr.Errors = append(merr.Errors, err)
}
Expand Down