-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Display hostname when running remotely #3356
Conversation
This is a solid improvement, thanks! |
Any chance to make this optional in command line ? like this:
Here I use LXC container and by this change I have to edit my /etc/hosts everytime a new container is instantiated. LXC doesn't make easy to bind locahost ports between Host and Container, like docker does. I still looking to some other ways to make a workaround in LXC. For now I am holding the notebook==5.4.1 to not get stuck |
I'm happy to give this a shot if it makes sense to do so. Maybe even something like However, this is really just a convenience change. It really shouldn't cause any functional difference, unless I'm not understanding how your configuration works? |
Hi... When I build a container for LXC it reserves a IP for the container and also register the specific IP number into a alias inside the container so I can call it easly. The alias has this pattern:
Until notebook==5.4.1, the access by the IP address was ok. When notebook==5.5.0rc1 showed up, translating ip into domain names / machine names, every time notebook become online i get this address http://container:8888/ that I cannot access by name unless I start to managing it into my /etc/hosts or remembering the original IP number from before. What do you propose ? |
I just found that the new version of LXD 3.0 released abril 2, supports the binding by creating a proxy for that. I will setup to see. If its true will be possible bind to my HOST by localhost and port. |
Hi again, Now I can bind to my HOST localhost on LXD 3.0 so independent of been Hostname or IP I can use localhost now. |
So the issue is/was that a container had a different host name internally and externally, so it was showing a name that wasn't useful externally? Maybe instead of special casing @cyberwillis I'm a bit confused by your last message; is this still a problem for you, or is it OK for you with the new version of LXD? Thanks for testing the RC! |
Hi, again It becames a problem when the new rc1 started to translate from IP to machine name, because I would have to manage of DNS internal on my host to translate it back. Anyway my problem was solved. I just ripped off the --ip argument and started to use the new version of my container runtime that can forward IPs and Ports for my localhost. But what I was tryied to explain earllier is that, is preferable to inform an IP like 192.168.1.30 and be accessible by it instead of translating into names. That's why I sugested a parameter that could let me choose if I need or not translation of the IP into machine name. |
Right, and we can add an option for it if we have to, but that's only helpful for people who've figured out what's gone wrong and discovered the option. If this is going to be a problem for a lot of people, I'd like to understand what's going on now and work out if we can make it work for more people without requiring them to set an option. |
So I've just tried it locally, and I think maybe it's more robust to change this logic: # What we have now:
if self.ip in ('localhost', '127.0.0.1', hostname):
ip = self.ip
else:
ip = hostname To something like this: # Proposed
if self.ip in ('', '0.0.0.0'):
ip = hostname
else:
ip = self.ip I.e. prefer the IP address where a meaningful one was specified, since that's potentially more likely to work from other machines, but use the hostname when we don't have a meaningful IP address, which is @evandam's use case. |
My team often runs Jupyter notebooks on a remote server, but 'localhost' is always displayed when running with an option like
--ip '*'
or--ip 0.0.0.0
, meaning the link isn't copy-and-pasteable when trying to connect from another machine.This change checks if you are running locally (either the current hostname,
localhost
, or127.0.0.1
) and displayslocalhost
as expected, but otherwise provides the server name.Hopefully this is the right way to go about proposing a change!