mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Change the default Host affectation to not rely on slice
This commit is contained in:
parent
1beb5005d1
commit
5e3f6e7023
1 changed files with 4 additions and 14 deletions
|
@ -38,10 +38,8 @@ func main() {
|
||||||
flDefaultIp = flag.String("ip", "0.0.0.0", "Default IP address to use when binding container ports")
|
flDefaultIp = flag.String("ip", "0.0.0.0", "Default IP address to use when binding container ports")
|
||||||
flInterContainerComm = flag.Bool("icc", true, "Enable inter-container communication")
|
flInterContainerComm = flag.Bool("icc", true, "Enable inter-container communication")
|
||||||
flGraphDriver = flag.String("s", "", "Force the docker runtime to use a specific storage driver")
|
flGraphDriver = flag.String("s", "", "Force the docker runtime to use a specific storage driver")
|
||||||
|
flHosts = docker.NewListOpts(docker.ValidateHost)
|
||||||
flHosts = docker.ListOpts{}
|
|
||||||
)
|
)
|
||||||
flHosts.Set(fmt.Sprintf("unix://%s", docker.DEFAULTUNIXSOCKET))
|
|
||||||
flag.Var(&flHosts, "H", "Multiple tcp://host:port or unix://path/to/socket to bind in daemon mode, single connection otherwise")
|
flag.Var(&flHosts, "H", "Multiple tcp://host:port or unix://path/to/socket to bind in daemon mode, single connection otherwise")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
@ -50,17 +48,9 @@ func main() {
|
||||||
showVersion()
|
showVersion()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// if flHosts.Len() > 1 {
|
if flHosts.Len() == 0 {
|
||||||
// flHosts = flHosts[1:] //trick to display a nice default value in the usage
|
// If we do not have a host, default to unix socket
|
||||||
// }
|
flHosts.Set(fmt.Sprintf("unix://%s", docker.DEFAULTUNIXSOCKET))
|
||||||
for _, flHost := range flHosts.GetAll() {
|
|
||||||
host, err := utils.ParseHost(docker.DEFAULTHTTPHOST, docker.DEFAULTHTTPPORT, flHost)
|
|
||||||
if err == nil {
|
|
||||||
flHosts.Set(host)
|
|
||||||
flHosts.Delete(flHost)
|
|
||||||
} else {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if *flDebug {
|
if *flDebug {
|
||||||
|
|
Loading…
Reference in a new issue