context: Endpoint.ClientOpts(): use client.WithVersionFromEnv()

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-03-25 00:18:20 +01:00
parent 1db2da57c8
commit 04347f793d
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 1 additions and 7 deletions

View File

@ -6,7 +6,6 @@ import (
"encoding/pem" "encoding/pem"
"net" "net"
"net/http" "net/http"
"os"
"time" "time"
"github.com/docker/cli/cli/connhelper" "github.com/docker/cli/cli/connhelper"
@ -122,12 +121,7 @@ func (c *Endpoint) ClientOpts() ([]client.Opt, error) {
} }
} }
version := os.Getenv("DOCKER_API_VERSION") result = append(result, client.WithVersionFromEnv(), client.WithAPIVersionNegotiation())
if version != "" {
result = append(result, client.WithVersion(version))
} else {
result = append(result, client.WithAPIVersionNegotiation())
}
return result, nil return result, nil
} }