Skip to content

Commit

Permalink
fix: resource host for rootless containers (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
mixedCase committed Apr 9, 2022
1 parent 23d5405 commit 230039c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dockertest.go
Expand Up @@ -69,7 +69,11 @@ func (r *Resource) GetBoundIP(id string) string {
return ""
}

return m[0].HostIP
ip := m[0].HostIP
if ip == "0.0.0.0" || ip == "" {
return "localhost"
}
return ip
}

// GetHostPort returns a resource's published port with an address.
Expand All @@ -84,7 +88,7 @@ func (r *Resource) GetHostPort(portID string) string {
}

ip := m[0].HostIP
if ip == "0.0.0.0" {
if ip == "0.0.0.0" || ip == "" {
ip = "localhost"
}
return net.JoinHostPort(ip, m[0].HostPort)
Expand Down

0 comments on commit 230039c

Please sign in to comment.