Using APIVersion negotiation instead of fixed version (#177)

Closes #137
This commit is contained in:
Ibrohim Kholilul Islam 2019-08-21 03:16:03 +07:00 committed by Manuel Vogel
parent 42354a7e62
commit 94b94b0478

View file

@ -17,8 +17,6 @@ import (
"github.com/docker/docker/client"
)
const apiVersion = "1.39"
// Config is the structure that stores the configuration to talk to a
// Docker API compatible host.
type Config struct {
@ -103,7 +101,7 @@ func (c *Config) NewClient() (*client.Client, error) {
return client.NewClientWithOpts(
client.WithHTTPClient(httpClient),
client.WithHost(c.Host),
client.WithVersion(apiVersion),
client.WithAPIVersionNegotiation(),
)
}
@ -115,7 +113,7 @@ func (c *Config) NewClient() (*client.Client, error) {
return client.NewClientWithOpts(
client.WithHost(c.Host),
client.WithTLSClientConfig(ca, cert, key),
client.WithVersion(apiVersion),
client.WithAPIVersionNegotiation(),
)
}
@ -128,14 +126,14 @@ func (c *Config) NewClient() (*client.Client, error) {
return client.NewClientWithOpts(
client.WithHost(helper.Host),
client.WithDialContext(helper.Dialer),
client.WithVersion(apiVersion),
client.WithAPIVersionNegotiation(),
)
}
// If there is no ssh://, then just return the direct client
return client.NewClientWithOpts(
client.WithHost(c.Host),
client.WithVersion(apiVersion),
client.WithAPIVersionNegotiation(),
)
}