lima-vm / lima-vm/lima

Lima binds only on IPv4

Open
#1,540 2 comments 0 reactions 0 assignees View on GitHub
area/ipv6
Dominant language
Go
Stars
21.9k
Forks
957
Avg merge
2d 6h
Merged PRs (30d)
53

Description

### Description

Hey there, folks!
I just stumbled on a rather odd thing, and at the time I wasn't sure what was happening:

> I’m using Colima, and for some reason, after starting a container through `docker compose run --rm -p 3000:3000 service-name`, another process managed to bind to the same port.

Initially, I thought the process was incorrectly indicating that it was listening on the port the container allocated, but no. If I tried to curl to port 3000, I hit the container, but my browser (tested with Arc and Safari) hits the other process!

Upon further inspection (thanks to Colima creator), I understood Lima's port-forwarding mechanism was only binding to the host's IPv4 address, leaving the IPv6 address free, and so allowing other applications to bind to this other address.
After finding [this](Vhttps://github.com/lima-vm/lima/blob/e57ac788162816ad189afd751017215687bc98bc/pkg/hostagent/hostagent.go#LL131C2-L131C2) I thought it was just a matter of allowing IPv4 bindings to also use the IPv6 address, but I guess I'm wrong.

PS: I'm totally willing to contribute with code, if it's okay; I woudl need some directions, though.

Contributor guide

Open the contributing guide

Research direction

Start by reading pkg/hostagent/hostagent.go around the referenced port-forwarding code, then reproduce the behavior with docker compose run --rm -p 3000:3000 service-name and requests over IPv4 and IPv6. Done means Lima's forwarded port behaves consistently on both host address families and does not leave the other address available for a conflicting listener.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.