File tree Expand file tree Collapse file tree
pkg/erdiscovery/dockerdiscovery Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 "context"
66 "fmt"
77 "log"
8+ "log/slog"
89 "net"
910 "net/http"
1011 "os"
@@ -272,6 +273,15 @@ func discoverDockerContainers(
272273 ipAddress = settings .IPAddress // fall back to bridge IP if not found
273274 }
274275
276+ if settings , found := container .NetworkSettings .Networks ["host" ]; ! ipFound () && found {
277+ // when host network, settings doesn't specify IP address
278+ if settings .IPAddress != "" {
279+ slog .Warn ("IPAddress not expected for host" , "container" , container .Id )
280+ continue
281+ }
282+ ipAddress = "127.0.0.1"
283+ }
284+
275285 // if container is attached to e.g. an overlay network, but Edgerouter sits e.g. in the host
276286 // network namespace (= no direct connectivity to the overlay network), our last-ditch effort
277287 // is to resolve its docker_gwbridge IP, but it is not visible from "$ docker inspect" output,
You can’t perform that action at this time.
0 commit comments