From 6cbd4f4f983a43dd869d696e53ab8ebe7cc5bec7 Mon Sep 17 00:00:00 2001 From: tomsweeneyredhat Date: Tue, 30 Jan 2024 18:14:16 -0500 Subject: [PATCH] [release-5.29] backport Docker Daemon fix #2260 Backport the fix from main for #2260 to allow for the lastest Docker Daemons to work with c/image. Signed-off-by: tomsweeneyredhat --- docker/daemon/client.go | 7 +------ docker/daemon/client_test.go | 2 -- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/docker/daemon/client.go b/docker/daemon/client.go index 2c245f54f..354af2140 100644 --- a/docker/daemon/client.go +++ b/docker/daemon/client.go @@ -9,11 +9,6 @@ import ( "github.com/docker/go-connections/tlsconfig" ) -const ( - // The default API version to be used in case none is explicitly specified - defaultAPIVersion = "1.22" -) - // NewDockerClient initializes a new API client based on the passed SystemContext. func newDockerClient(sys *types.SystemContext) (*dockerclient.Client, error) { host := dockerclient.DefaultDockerHost @@ -23,7 +18,7 @@ func newDockerClient(sys *types.SystemContext) (*dockerclient.Client, error) { opts := []dockerclient.Opt{ dockerclient.WithHost(host), - dockerclient.WithVersion(defaultAPIVersion), + dockerclient.WithAPIVersionNegotiation(), } // We conditionalize building the TLS configuration only to TLS sockets: diff --git a/docker/daemon/client_test.go b/docker/daemon/client_test.go index 161747f75..021e24d13 100644 --- a/docker/daemon/client_test.go +++ b/docker/daemon/client_test.go @@ -18,7 +18,6 @@ func TestDockerClientFromNilSystemContext(t *testing.T) { assert.NotNil(t, client, "A Docker client reference should have been returned") assert.Equal(t, dockerclient.DefaultDockerHost, client.DaemonHost(), "The default docker host should have been used") - assert.Equal(t, defaultAPIVersion, client.ClientVersion(), "The default api version should have been used") assert.NoError(t, client.Close()) } @@ -39,7 +38,6 @@ func TestDockerClientFromCertContext(t *testing.T) { assert.NotNil(t, client, "A Docker client reference should have been returned") assert.Equal(t, host, client.DaemonHost()) - assert.Equal(t, "1.22", client.ClientVersion()) assert.NoError(t, client.Close()) }