From 94b94b04788f858a44389da1db4bac3eb87ce6ec Mon Sep 17 00:00:00 2001 From: Ibrohim Kholilul Islam Date: Wed, 21 Aug 2019 03:16:03 +0700 Subject: [PATCH] Using APIVersion negotiation instead of fixed version (#177) Closes #137 --- docker/config.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docker/config.go b/docker/config.go index dab37724..f9e3c40a 100644 --- a/docker/config.go +++ b/docker/config.go @@ -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(), ) }