mirror of https://github.com/k3s-io/k3s
dockershim: Fix negotiating docker API version
API version negotiation needs to happen before any meaningful docker calls, including simple commands such as "/version".k3s-v1.15.3
parent
631bf8cbc8
commit
903f635ab3
|
@ -85,15 +85,12 @@ func newKubeDockerClient(dockerClient *dockerapi.Client, requestTimeout, imagePu
|
|||
timeout: requestTimeout,
|
||||
imagePullProgressDeadline: imagePullProgressDeadline,
|
||||
}
|
||||
|
||||
// Notice that this assumes that docker is running before kubelet is started.
|
||||
v, err := k.Version()
|
||||
if err != nil {
|
||||
klog.Errorf("failed to retrieve docker version: %v", err)
|
||||
klog.Warningf("Using empty version for docker client, this may sometimes cause compatibility issue.")
|
||||
} else {
|
||||
// Update client version with real api version.
|
||||
dockerClient.NegotiateAPIVersionPing(dockertypes.Ping{APIVersion: v.APIVersion})
|
||||
}
|
||||
ctx, cancel := k.getTimeoutContext()
|
||||
defer cancel()
|
||||
dockerClient.NegotiateAPIVersion(ctx)
|
||||
|
||||
return k
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue