Skip to content

Conversation

@afbjorklund
Copy link
Member

Fix the hostname command, instead of switching to the built-in port forwarding.

Problem is that every WSL distribution will otherwise report the IP as 127.0.0.1:22.

Reverts:

Fixes:


https://learn.microsoft.com/en-us/windows/wsl/networking

Note that hostname -i returns 127.0.1.1, on Ubuntu/Alpine

@afbjorklund
Copy link
Member Author

We don't actually have any rootfs images based on Alpine, but it can be tested in a docker container I suppose.

docker run -it ubuntu bash -c "hostname -I | cut -d ' ' -f1"
docker run -it alpine sh -c "ip route get 1 | awk '{gsub(\"^.*src \",\"\"); print $1; exit}'"

Unfortunately WSL doesn't provide any sane method, to query the IP of the "distro" from the outside (host)...

https://learn.microsoft.com/en-us/windows/wsl/networking

Compare: docker inspect --format='{{ .NetworkSettings.IPAddress }}'

@AkihiroSuda AkihiroSuda added this to the v2.0.0 milestone Aug 19, 2025
This reverts commit ebaa100.

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@jandubois jandubois merged commit ae2b230 into lima-vm:master Aug 19, 2025
61 of 63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants