Skip to content

hostIP: "127.0.0.1" shouldn't be hardcoded (to support exposing <nerdctl|docker|podman> run -p 0.0.0.0:80:80) #658

Closed
@AkihiroSuda

Description

@AkihiroSuda

Description

Currently <nerdctl|docker|podman> run -p 0.0.0.0:80:80 does not listen the port on host 0.0.0.0, because hostIP: "127.0.0.1" is hardcoded:

# # Lima internally appends this fallback rule at the end:
# - guestIP: "127.0.0.1"
# guestPortRange: [1, 65535]
# hostIP: "127.0.0.1"
# hostPortRange: [1, 65535]

We should probably use 0.0.0.0 when the guest uses 0.0.0.0.

The guest agent is already aware of "0.0.0.0" IP.

type IPPort struct {
IP net.IP `json:"ip"`
Port int `json:"port"`
}
func (x *IPPort) String() string {
return net.JoinHostPort(x.IP.String(), strconv.Itoa(x.Port))
}
type Info struct {
// LocalPorts contain 127.0.0.1 and 0.0.0.0.
// LocalPorts do NOT contain addresses such as 127.0.0.53 and 192.168.5.15.
//
// In future, LocalPorts will contain IPv6 addresses (::1 and ::) as well.
LocalPorts []IPPort `json:"localPorts"`
}

Background:

cc @abiosoft

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions