-
Notifications
You must be signed in to change notification settings - Fork 603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hostIP: "127.0.0.1"
shouldn't be hardcoded (to support exposing <nerdctl|docker|podman> run -p 0.0.0.0:80:80
)
#658
Comments
This is a breaking change, and probably needs bumping up the major version. |
I don't understand why we need to change it; this is just being secure by default, which seems like a reasonable position to me. You can always change it in your portForwards:
- guestPortRange: [1, 65535]
hostIP: "0.0.0.0" This is what Rancher Desktop (and I think colima) do because Docker Desktop does the same thing. This is already possible without changing the defaults. It would be useful for a rule to match only when the guest binds to portForwards:
- guestBindAll: true
guestPortRange: [1, 65535]
hostIP: "0.0.0.0" Please suggest a better name than |
The name is not as bad as you make it sound :D.
This can work. To achieve forwarding to both portForwards:
- guestPortRange: [1, 65535]
hostIP: "127.0.0.1"
- guestPortRange: [1, 65535]
guestBindAll: true
hostIP: "0.0.0.0" This is a welcoming suggestion as it would no longer be a breaking change if |
That is wrong, the default is So the rules need to be in the opposite order: we need to start with a rule that matches portForwards:
- guestPortRange: [1, 65535]
guestBindAll: true
guestIP: "0.0.0.0"
hostIP: "0.0.0.0"
- guestPortRange: [1, 65535]
guestIP: "0.0.0.0"
hostIP: "127.0.0.1" I still don't like the name (it is not self-explanatory to me), but I struggle to find a good one. Maybe even Maybe I'm going to try to implement this, but I won't be able to finish it tonight. |
This was easier than expected (but then I haven't tested it yet): #660. Still needs docs and tests, but if somebody has time to try it and provide feedback, that would be great. I'll finish it tomorrow! |
Tested and works as expected 🎉 Config portForwards:
- guestIPZero: true
guestIP: 0.0.0.0
guestPortRange: [1, 65536]
hostIP: 0.0.0.0
hostPortRange: [1, 65536]
- guestIP: 127.0.0.1
guestPortRange: [1, 65536]
hostIP: 127.0.0.1
hostPortRange: [1, 65536] Execution # 127.0.0.1
$ docker run --rm -d -p 127.0.0.1:8080:80 caddy
$ lsof -nP -iTCP:"8080" | grep LISTEN
ssh 50881 abiola 21u IPv4 0xcfe12ce33b303c13 0t0 TCP 127.0.0.1:8080 (LISTEN)
# 0.0.0.0
$ docker run --rm -d -p 8080:80 caddy
$ lsof -nP -iTCP:"8080" | grep LISTEN
ssh 50881 abiola 20u IPv4 0xcfe12ce33b569c13 0t0 TCP *:8080 (LISTEN) |
Thanks - this looks great 👍 One consideration: Maybe instead of a new property „*“ could be used in the same way as the lsof report shows to distinguish between 0.0.0.0 and 0.0.0.0 with guest ip zero set to true? Besides that guestIPZero is easy enough to set. |
If we were starting from scratch, then To maintain backwards compatibility, we cannot change this. So we don't need an alternative syntax to specify wildcarding, but rather the opposite. Adding a restricting rule qualifier is still the best I can think of. I think I will go with |
SGTM |
@AkihiroSuda When testing with
Is this a bug in |
Works for me, both rootless and rootful
|
I notice same behaviour and it seems to be specific to nerdctl on Alpine. When I tried with Ubuntu, I got the desired behaviour. |
Description
Currently
<nerdctl|docker|podman> run -p 0.0.0.0:80:80
does not listen the port on host 0.0.0.0, becausehostIP: "127.0.0.1"
is hardcoded:lima/pkg/limayaml/default.yaml
Lines 218 to 222 in 71861bc
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.
lima/pkg/guestagent/api/api.go
Lines 13 to 28 in 71861bc
Background:
docker run
or docker-compose is not respected, so services can be exposed on network abiosoft/colima#186 (comment)cc @abiosoft
The text was updated successfully, but these errors were encountered: