@@ -22,12 +22,10 @@ import (
22
22
)
23
23
24
24
const (
25
- // minDockerAPILinux is the min Docker API version supported by agent
26
- minDockerAPILinux = Version_1_17
27
25
// minAPIVersionKey is the docker.Env key for min API version
28
- minAPIVersionKey = "MinAPIVersion"
26
+ minAPIVersionKey = "MinAPIVersion"
29
27
// apiVersionKey is the docker.Env key for API version
30
- apiVersionKey = "ApiVersion"
28
+ apiVersionKey = "ApiVersion"
31
29
)
32
30
// Factory provides a collection of docker remote clients that include a
33
31
// recommended client version as well as a set of alternative supported
@@ -122,7 +120,7 @@ func findDockerVersions(endpoint string) map[DockerVersion]dockeriface.Client {
122
120
// Docker versions
123
121
clients , err := findDockerVersionsfromMinMaxVersions (endpoint )
124
122
if err != nil {
125
- log .Infof ( "Error getting Docker clients from min API version: %v" , err )
123
+ log .Debugf ( "Unable to get Docker clients from min API version: %v" , err )
126
124
} else {
127
125
return clients
128
126
}
@@ -146,14 +144,14 @@ func findDockerVersions(endpoint string) map[DockerVersion]dockeriface.Client {
146
144
147
145
func findDockerVersionsfromMinMaxVersions (endpoint string ) (map [DockerVersion ]dockeriface.Client , error ) {
148
146
// get a Docker client with the default supported version
149
- client , err := newVersionedClient (endpoint , string (minDockerAPILinux ))
147
+ client , err := newVersionedClient (endpoint , string (minDockerAPIVersion ))
150
148
if err != nil {
151
- return nil , errors .Wrap (err , "Error while creating client" )
149
+ return nil , errors .Wrap (err , "min API version check: error while creating default Docker client" )
152
150
}
153
151
154
152
clientVersion , err := client .Version ()
155
153
if err != nil {
156
- return nil , errors .Wrap (err , "Error while getting client version" )
154
+ return nil , errors .Wrap (err , "min API version check: error while getting client version" )
157
155
}
158
156
159
157
clients := make (map [DockerVersion ]dockeriface.Client )
@@ -164,7 +162,7 @@ func findDockerVersionsfromMinMaxVersions(endpoint string) (map[DockerVersion]do
164
162
for _ , version := range getKnownAPIVersions () {
165
163
dockerClient , err := getDockerClientForVersion (endpoint , string (version ), minAPIVersion , apiVersion )
166
164
if err != nil {
167
- log .Infof ( "Error getting client version: %v" , err )
165
+ log .Debugf ( "Unable to get Docker client for version %s : %v", version , err )
168
166
continue
169
167
}
170
168
clients [version ] = dockerClient
@@ -184,19 +182,19 @@ func getDockerClientForVersion(
184
182
minVersionCheck , minErr := utils .Version (version ).Matches (lessThanMinCheck )
185
183
maxVersionCheck , maxErr := utils .Version (version ).Matches (moreThanMaxCheck )
186
184
if minErr != nil {
187
- return nil , errors .Wrapf (minErr , "Error while comparing version %s with minAPIVersion %s" , version , minAPIVersion )
185
+ return nil , errors .Wrapf (minErr , "error while comparing version %s with minAPIVersion %s" , version , minAPIVersion )
188
186
}
189
187
if maxErr != nil {
190
- return nil , errors .Wrapf (minErr , "Error while comparing version %s with apiVersion %s" , version , apiVersion )
188
+ return nil , errors .Wrapf (minErr , "error while comparing version %s with apiVersion %s" , version , apiVersion )
191
189
}
192
190
// do not add the version when it is less than min api version or greater
193
191
// than api version
194
192
if minVersionCheck || maxVersionCheck {
195
- return nil , errors .Errorf ("Min and API versions comparison check failed for version: %s" , version )
193
+ return nil , errors .Errorf ("min and API versions comparison check failed for version: %s" , version )
196
194
}
197
195
client , err := newVersionedClient (endpoint , string (version ))
198
196
if err != nil {
199
- return nil , errors .Wrap (err , "Error while creating client" )
197
+ return nil , errors .Wrapf (err , "unable to create Docker client for version: %s" , version )
200
198
}
201
199
return client , nil
202
200
}
0 commit comments