When CRI runtime is not docker, don't init docker socket
@@ -104,6 +104,9 @@ func sameFileStat(requireMode bool, src, dst string) bool {
// EnsureDocker attempts to connect to the Docker daemon defined by the helper,
// and if it is unable to it will print a warning.
func (c *NodeConfig) EnsureDocker(docker *dockerutil.Helper) {
+ if c.KubeletServer.ContainerRuntime != "docker" {
+ return
+ }
dockerClient, dockerAddr, err := docker.GetKubeClient(c.KubeletServer.RuntimeRequestTimeout.Duration, c.KubeletServer.ImagePullProgressDeadline.Duration)
if err != nil {
c.HandleDockerError(fmt.Sprintf("Unable to create a Docker client for %s - Docker must be installed and running to start containers.\n%v", dockerAddr, err))
@@ -264,6 +267,7 @@ func (c *NodeConfig) RunKubelet() {
c.KubeletServer.ClusterDNS = []string{clusterDNS.String()}
}
+ // only set when ContainerRuntime == "docker"
c.KubeletDeps.DockerClient = c.DockerClient
// updated by NodeConfig.EnsureVolumeDir
c.KubeletServer.RootDirectory = c.VolumeDir
