Fix docker daemon exit immediately after starting without -H option closes #16927

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: e38767e197a1456458cda53b4558f56f5b6f22fa
Component: engine
This commit is contained in:
Lei Jitang
2015-10-12 04:49:25 -04:00
parent b34ed2cbab
commit eaf757b644
3 changed files with 33 additions and 4 deletions

View File

@ -224,6 +224,9 @@ func (cli *DaemonCli) CmdDaemon(args ...string) error {
defaultHost = opts.DefaultTLSHost
}
if len(commonFlags.Hosts) == 0 {
commonFlags.Hosts = make([]string, 1)
}
for i := 0; i < len(commonFlags.Hosts); i++ {
var err error
if commonFlags.Hosts[i], err = opts.ParseHost(defaultHost, commonFlags.Hosts[i]); err != nil {