-
Notifications
You must be signed in to change notification settings - Fork 5k
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
localhost is replaced by the docker container name in 5.5.0 #3605
Comments
Does the new URL work if you use that in your browser? This was changed in #3356 and refined in #3593. The idea is that when it's asked to listen on all interfaces, it shows the hostname of the computer it's running on, which can work from another computer. Your docker command maps the container port to a port on localhost, but the notebook running in the container doesn't know about that. E.g. you could ask Docker to put it on a different port, like 8889, and it would print out the URL with |
Right, that description makes sense
Unfortunately not. IIRC Could we print an address that's likely to work? Or a config for the address to print? |
That's what this is trying to do! It's hard to get right, though. The server doesn't know what name or IP address you need to reach the system it's running on - especially when there's port forwarding, tunnelling or proxying involved.
It's probably reasonable to have a way to override this. Do you want to make a PR? |
👍 We could know that a hash is unlikely to be correct, but could we in a systematic way? I'm not up on my networking - is my local called
Yes. I'm going on vacation for ten days now, but let's see if anyone has any improvement over the config, and then I will. |
I don't even know that it's unlikely to be correct. If you're managing a lot of machines, maybe you automatically assign hostnames in that format. I suspect that's what docker is doing, but you need some extra option to make them reachable at that name.
Yup, localhost is a special name for the computer to access itself. But I think in the case of docker, each container counts as a separate machine, so something running in docker is not on 'localhost', unless you use the |
Thanks for the replies
TBC, this was forwarding the port (otherwise I don't see how it could work with |
I am running into this issue as well. A bugfix that would work for me is adding a param where the base URL can be overridden. |
Borrowing from discussion in a StackOverflow thread, one could replace the with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.connect(('<broadcast>', 0))
ip = s.getsockname()[0] When running within Docker, this gives a URL of |
Thanks, that's interesting. A few concerns:
@minrk you understand this stuff better than I do, could you take a look at the suggestion above? |
I don't believe it's possible to get the right answer every time, or even most of the time, inside a container because the container doesn't know what port or ip is accessible from the outside:
The only general solution, I think, is to have a "connect_host" config that overrides the connectable address to be echoed here. It should include both the hostname and port in order to handle the fact that the port cannot be known from inside the container. This would have to come from the user manually at start time. With that, we could have:
echo the correct URL:
From the utilities we already have, we can change the default something like what @BradenAtSiemens proposes, by echoing the first or all of
in a docker container. However, for me (on macOS), this ip does not work, only localhost does, so we could either show both this ip and localhost, or just go back to using localhost in this case. |
I've tagged this as 'help wanted' for someone to have a go at implementing @minrk 's suggestion in the message above, to make a configurable connect_host option. |
If I understood @minrk proposal correctly, the proposal would be to add a new option to Seems to me that in the general case, it would be useful for this option to also override the protocol part (also the |
Basically, yes. Set the display_url directly, without anything being generated from other values. |
Ok so I created PR #3668 to implement this. I kept the Note that I also implemented it to override the |
In 5.4.1, the url is printed and works as
localhost
, belowBut with 5.5.0,
8bc26195e104
appears.With
docker ps
, I can see that the docker Container ID is8bc26195e104
For reference, here's the config file:
The text was updated successfully, but these errors were encountered: