mirror of https://github.com/docker/docs.git
Merge pull request #12716 from Microsoft/10662-defaultlistener
Windows: Change default listener to HTTP
This commit is contained in:
commit
abf1a14bfe
|
@ -6,6 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
|
@ -62,8 +63,13 @@ func main() {
|
||||||
if len(flHosts) == 0 {
|
if len(flHosts) == 0 {
|
||||||
defaultHost := os.Getenv("DOCKER_HOST")
|
defaultHost := os.Getenv("DOCKER_HOST")
|
||||||
if defaultHost == "" || *flDaemon {
|
if defaultHost == "" || *flDaemon {
|
||||||
|
if runtime.GOOS != "windows" {
|
||||||
// If we do not have a host, default to unix socket
|
// If we do not have a host, default to unix socket
|
||||||
defaultHost = fmt.Sprintf("unix://%s", opts.DefaultUnixSocket)
|
defaultHost = fmt.Sprintf("unix://%s", opts.DefaultUnixSocket)
|
||||||
|
} else {
|
||||||
|
// If we do not have a host, default to TCP socket on Windows
|
||||||
|
defaultHost = fmt.Sprintf("tcp://%s:%d", opts.DefaultHTTPHost, opts.DefaultHTTPPort)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
defaultHost, err := opts.ValidateHost(defaultHost)
|
defaultHost, err := opts.ValidateHost(defaultHost)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -17,6 +17,10 @@ var (
|
||||||
alphaRegexp = regexp.MustCompile(`[a-zA-Z]`)
|
alphaRegexp = regexp.MustCompile(`[a-zA-Z]`)
|
||||||
domainRegexp = regexp.MustCompile(`^(:?(:?[a-zA-Z0-9]|(:?[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]))(:?\.(:?[a-zA-Z0-9]|(:?[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])))*)\.?\s*$`)
|
domainRegexp = regexp.MustCompile(`^(:?(:?[a-zA-Z0-9]|(:?[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]))(:?\.(:?[a-zA-Z0-9]|(:?[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])))*)\.?\s*$`)
|
||||||
DefaultHTTPHost = "127.0.0.1" // Default HTTP Host used if only port is provided to -H flag e.g. docker -d -H tcp://:8080
|
DefaultHTTPHost = "127.0.0.1" // Default HTTP Host used if only port is provided to -H flag e.g. docker -d -H tcp://:8080
|
||||||
|
// TODO Windows. DefaultHTTPPort is only used on Windows if a -H parameter
|
||||||
|
// is not supplied. A better longer term solution would be to use a named
|
||||||
|
// pipe as the default on the Windows daemon.
|
||||||
|
DefaultHTTPPort = 2375 // Default HTTP Port
|
||||||
DefaultUnixSocket = "/var/run/docker.sock" // Docker daemon by default always listens on the default unix socket
|
DefaultUnixSocket = "/var/run/docker.sock" // Docker daemon by default always listens on the default unix socket
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue