When creating and managing multiple machines, it is confusing to identify which machine you have logged into after using machine ssh
. Setting the hostname to match the machine name would be useful in this scenario.
(woops I initially raised this against swarm by accident)
There was some discussion about this on IRC. I also went back and forth on this with @tianon a while back.
I think the original reasoning was that:
1) We don't want name conflicts.
2) Renaming hosts is a pain.
I agree though, it's a bit odd having hostnames set automatically. Maybe we can assume that the hostname is going to be incorrect if you rename a machine. Or perhaps we don't allow you to rename a machine. Or perhaps we only give machines automatically generated names if the provider makes renaming difficult.
The purpose of this issue is really to be able to identify machines from the prompt when logged in via machine ssh
, maybe it would help to re-open this issue in that context?
I like the idea of having the host match the machine. Perhaps we forbid the rename? This would follow Docker as well as far as names.
If this is to _identify_ a machine, perhaps the new "labels" and "name" properties should be looked at. If I understood those correctly, they were added by the "Swarm" team to be able to identify a specific host in the cluster. There's still one PR open to manage this; https://github.com/docker/docker/pull/9571
And this is the PR for labels (which is in the 1.4 release): https://github.com/docker/docker/pull/9265
Edit: Added link to "labels" PR
Specifically I was concerned with identifying the machine from the prompt. That doesn't necessarily mean setting the hostname - an alternative would be to customise the prompt, for example.
We can have renaming where renaming is possible. If a driver can't do renames, it can just throw an error.
+1
On Monday, December 15, 2014, Ben Firshman [email protected] wrote:
We can have renaming where renaming is possible. If a driver can't do
renames, it can just throw an error.—
Reply to this email directly or view it on GitHub
https://github.com/docker/machine/issues/59#issuecomment-67040323.
If I've read this issue correctly, the implementation should be:
machine move/rename
which will change a machine's name in the internal data store and change the hostnameI don't think renaming is necessary to start with - that's already being worked on here https://github.com/docker/machine/issues/59
At the moment we give hostnames long random names. I think we should set the name on the provider to be the name given by the user, which normally is also the hostname given to the machine. For example – when you create a droplet on digital ocean, you give it a name, which is also used by the hostname.
Another thing to be aware of: the name given by the user might already exist on the provider. We should display useful error messages about this.
I absolutely agree with setting the name on the provider too. Things like EC2 won't care since the unique criteria will be the instance id.
As per:
I don't think renaming is necessary to start with - that's already being worked on here #59
That's this issue :)
+1 for setting the name / hostname on the provider if supported. I agree to leave renaming / moving out of this one -- I believe bfirsh meant #30 is being worked on for that.
I'll give it a go :)
Oh whoops, yes, wrong issue. Sorry.
Thanks @sthulb!
Closing as #219 has been merged.
How can I disable host renaming?
Most helpful comment
How can I disable host renaming?