Files
docker-cli/components/engine/client/utils.go
John Howard b16c7d965b Tidy GetDockerOS() function
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: d8dcbf3ec347ceb3da0d960ffe51f1ab1bb32a83
Component: engine
2016-11-09 14:46:53 -08:00

16 lines
376 B
Go

package client
import "regexp"
var headerRegexp = regexp.MustCompile(`\ADocker/.+\s\((.+)\)\z`)
// getDockerOS returns the operating system based on the server header from the daemon.
func getDockerOS(serverHeader string) string {
var osType string
matches := headerRegexp.FindStringSubmatch(serverHeader)
if len(matches) > 0 {
osType = matches[1]
}
return osType
}