Skip to content

Commit 764193d

Browse files
committed
Make Docker container names on non-default networks routable
1 parent 24688dc commit 764193d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/interceptors/docker/docker-networking.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ class DockerNetworkMonitor {
338338
} else {
339339
// Elsewhere it's true for *all* traffic:
340340
aliases.push([container.Config.Hostname, containerIp]);
341+
342+
// In some cases (custom name defined) which we can't reliably detect, on non-default
343+
// networks it's also possible to resolve a container using just its container name
344+
// (with the leading slash stripped). To handle that we just route all names:
345+
aliases.push([container.Name.slice(1), containerIp]);
341346
}
342347

343348
// Every container can be accessed by any configured aliases on this network:

0 commit comments

Comments
 (0)