From 5852d59e6d8e5a702123a845ea090a666a8f9136 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 29 Jun 2017 22:08:42 -0700 Subject: [PATCH] Fix NewVersionError() for clients using default version The NewVersionError checks if the client is using the API version required for using a specific feature. If the client is initialized without setting a specific version, an error would be generated because it was not possible to compare versions. However, a client without explicit version set is running the latest supported version. This patch changes the behavior to only generate an error if a version was set. Signed-off-by: Sebastiaan van Stijn Upstream-commit: ff2ed1853099a210245814b4263ce1c92b14c153 Component: engine --- components/engine/client/errors.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/client/errors.go b/components/engine/client/errors.go index e0effafc0a..fc7df9f1eb 100644 --- a/components/engine/client/errors.go +++ b/components/engine/client/errors.go @@ -228,7 +228,7 @@ func IsErrPluginPermissionDenied(err error) bool { // NewVersionError returns an error if the APIVersion required // if less than the current supported version func (cli *Client) NewVersionError(APIrequired, feature string) error { - if versions.LessThan(cli.version, APIrequired) { + if cli.version != "" && versions.LessThan(cli.version, APIrequired) { return fmt.Errorf("%q requires API version %s, but the Docker daemon API version is %s", feature, APIrequired, cli.version) } return nil