Skip to content

Commit d1442d0

Browse files
committed
Add support for newer (Docker Engine) API versions
1 parent 78d9cf3 commit d1442d0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/rawdns/docker.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ import (
99
"net/url"
1010
)
1111

12+
// TODO use "docker network ls" + "docker network inspect" to get lists of containers + IPs for implementing reverse DNS lookups that don't require inspecting *every* container to resolve! (can even skip "host" and "none" automatically, or even *any* network whose driver is "host" or "null")
13+
1214
var (
1315
dockerApiVersions = []string{
16+
// https://github.com/moby/moby/pull/51186
17+
"v1.52", // Docker 29.0.x
18+
"v1.44", // Docker 25.0.x
19+
1420
// https://github.com/moby/moby/pull/46887
1521
"v1.41", // Docker 20.10.x
1622

@@ -70,7 +76,7 @@ func dockerGetIpList(dockerHost, containerName string, tlsConfig *tls.Config, sw
7076
continue
7177
}
7278

73-
if swarmNode {
79+
if swarmNode && container.Node.IP != "" {
7480
return []net.IP{net.ParseIP(container.Node.IP)}, nil
7581
}
7682

0 commit comments

Comments
 (0)