1 Star 0 Fork 0

powerpaas/machine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
docker_versioner.go 700 Bytes
一键复制 编辑 原始数据 按行查看 历史
package mcndockerclient
import "fmt"
var CurrentDockerVersioner DockerVersioner = &defaultDockerVersioner{}
type DockerVersioner interface {
DockerVersion(host DockerHost) (string, error)
}
func DockerVersion(host DockerHost) (string, error) {
return CurrentDockerVersioner.DockerVersion(host)
}
type defaultDockerVersioner struct{}
func (dv *defaultDockerVersioner) DockerVersion(host DockerHost) (string, error) {
client, err := DockerClient(host)
if err != nil {
return "", fmt.Errorf("Unable to query docker version: %s", err)
}
version, err := client.Version()
if err != nil {
return "", fmt.Errorf("Unable to query docker version: %s", err)
}
return version.Version, nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/powerpaas/machine.git
git@gitee.com:powerpaas/machine.git
powerpaas
machine
machine
v0.15.0-rancher5

搜索帮助