Skip to content

Commit

Permalink
client: don't skip version check if DOCKER_API_VERSION is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
fsouza committed Aug 27, 2019
1 parent a439aa3 commit cb0c0a0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,12 @@ func NewVersionedTLSClient(endpoint string, cert, key, ca, apiVersionString stri
// See https://github.com/docker/compose/blob/81707ef1ad94403789166d2fe042c8a718a4c748/compose/cli/docker_client.py#L7.
// See https://github.com/moby/moby/blob/28d7dba41d0c0d9c7f0dafcc79d3c59f2b3f5dc3/client/options.go#L51
func NewClientFromEnv() (*Client, error) {
client, err := NewVersionedClientFromEnv(os.Getenv("DOCKER_API_VERSION"))
apiVersionString := os.Getenv("DOCKER_API_VERSION")
client, err := NewVersionedClientFromEnv(apiVersionString)
if err != nil {
return nil, err
}
client.SkipServerVersionCheck = true
client.SkipServerVersionCheck = apiVersionString == ""
return client, nil
}

Expand Down

0 comments on commit cb0c0a0

Please sign in to comment.