libmachine/provision/utils.go
func DockerClientVersion(ssh SSHCommander) (string, error) {
	// `docker version --format {{.Client.Version}}` would be preferable, but
	// that fails if the server isn't running yet.
	//
	// output is expected to be something like
	//
	//     Docker version 1.12.1, build 7a86f89
	output, err := ssh.SSHCommand("docker --version")
	if err != nil {
		return "", err
	}

	words := strings.Fields(output)
	if len(words) < 3 || words[0] != "Docker" || words[1] != "version" {
		return "", fmt.Errorf("DockerClientVersion: cannot parse version string from %q", output)
	}

	return strings.TrimRight(words[2], ","), nil
}
func DockerClientVersion(ssh SSHCommander) (string, error) {
	// `docker version --format {{.Client.Version}}` would be preferable, but
	// that fails if the server isn't running yet.
	//
	// output is expected to be something like
	//
	//     Docker version 1.12.1, build 7a86f89
	output, err := ssh.SSHCommand("docker --version")
	if err != nil {
		return "", err
	}

	words := strings.Fields(output)
	if len(words) < 3 || words[0] != "Docker" || words[1] != "version" {
		return "", fmt.Errorf("DockerClientVersion: cannot parse version string from %q", output)
	}

	return strings.TrimRight(words[2], ","), nil
}
func DockerClientVersion ( ssh SSHCommander ) ( string , error ) { // `docker version --format {{.Client.Version}}` would be preferable, but // that fails if the server isn't running yet. // // output is expected to be something like // //     Docker version 1.12.1, build 7a86f89 output , err := ssh . SSHCommand ( " " ) if err != nil { return " " , err } words := strings . Fields ( output ) if len ( words ) < 3 || words [ 0 ] != " " || words [ 1 ] != " " { return " " , fmt . Errorf ( " " , output ) } return strings . TrimRight ( words [ 2 ] , " " ) , nil }
// DockerClientVersion returns the version of the Docker client on the host
// that ssh is connected to, e.g. "1.12.1".
DockerClientVersion returns the version of the Docker client on the host that ssh is connected to e . g . 1 . 12 . 1 .