Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Display hostname when running remotely #3356
My team often runs Jupyter notebooks on a remote server, but 'localhost' is always displayed when running with an option like
This change checks if you are running locally (either the current hostname,
Hopefully this is the right way to go about proposing a change!
Feb 27, 2018
Any chance to make this optional in command line ?
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?
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 ?
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!
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.