Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 5effd71

Browse files
authored
Merge pull request #441 from thaJeztah/19.03_backport_fix_double_host
[19.03 backport] daemon: don't listen on the same address multiple times Upstream-commit: c3936abb675e88a62215d7fac9f52b365f273ca6 Component: engine
2 parents 102b097 + ec42333 commit 5effd71

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

components/engine/cmd/dockerd/daemon.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,11 +608,17 @@ func newAPIServerConfig(cli *DaemonCli) (*apiserver.Config, error) {
608608

609609
func loadListeners(cli *DaemonCli, serverConfig *apiserver.Config) ([]string, error) {
610610
var hosts []string
611+
seen := make(map[string]struct{}, len(cli.Config.Hosts))
612+
611613
for i := 0; i < len(cli.Config.Hosts); i++ {
612614
var err error
613615
if cli.Config.Hosts[i], err = dopts.ParseHost(cli.Config.TLS, honorXDG, cli.Config.Hosts[i]); err != nil {
614616
return nil, errors.Wrapf(err, "error parsing -H %s", cli.Config.Hosts[i])
615617
}
618+
if _, ok := seen[cli.Config.Hosts[i]]; ok {
619+
continue
620+
}
621+
seen[cli.Config.Hosts[i]] = struct{}{}
616622

617623
protoAddr := cli.Config.Hosts[i]
618624
protoAddrParts := strings.SplitN(protoAddr, "://", 2)

0 commit comments

Comments
 (0)