From 382d9ed477a45ff5b6a4199ef15f4651b0f00cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=C3=A1n=20C=20McCord?= Date: Mon, 23 Jul 2018 06:38:53 -0400 Subject: [PATCH] ignore docker interfaces in default private IP determination --- discover/discover.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/discover/discover.go b/discover/discover.go index dbc60a3..19d203b 100644 --- a/discover/discover.go +++ b/discover/discover.go @@ -207,6 +207,7 @@ func defaultPublicIPv6() (net.IP, error) { return ip, nil } +// nolint: gocyclo func defaultPrivateIPv4() (net.IP, error) { netifs, err := net.Interfaces() if err != nil { @@ -214,6 +215,12 @@ func defaultPrivateIPv4() (net.IP, error) { } for _, i := range netifs { + + // Skip docker interfaces + if strings.HasPrefix(i.Name, "docker") { + continue + } + addresses, err := i.Addrs() if err != nil { continue // next interface