// Helper for getting the docker version.
func getDockerVersion(cadvisor cadvisor.Interface) *utilversion.Version {
	versions, err := cadvisor.VersionInfo()
	if err != nil {
		glog.Errorf("Error requesting cAdvisor VersionInfo: %v", err)
		return utilversion.MustParseSemantic("0.0.0")
	}
	dockerVersion, err := utilversion.ParseSemantic(versions.DockerVersion)
	if err != nil {
		glog.Errorf("Error parsing docker version %q: %v", versions.DockerVersion, err)
		return utilversion.MustParseSemantic("0.0.0")
	}
	return dockerVersion
}
예제 #2
0
// Helper for getting the docker version.
func getDockerVersion(cadvisor cadvisor.Interface) semver.Version {
	var fallback semver.Version // Fallback to zero-value by default.
	versions, err := cadvisor.VersionInfo()
	if err != nil {
		glog.Errorf("Error requesting cAdvisor VersionInfo: %v", err)
		return fallback
	}
	dockerVersion, err := semver.Parse(versions.DockerVersion)
	if err != nil {
		glog.Errorf("Error parsing docker version %q: %v", versions.DockerVersion, err)
		return fallback
	}
	return dockerVersion
}