Don't smoosh hostname and domainname in API#20200
Don't smoosh hostname and domainname in API#20200calavera merged 1 commit intomoby:masterfrom thockin:14282-hostname-domainname-v2
Conversation
|
Haven't had a chance to play with this, but it looks like a promising fix to the originally thorny problem of figuring out the intent vs. distro differences that brought up the original bug. When you say I think the only downside is that for non-API uses with a FQDN in |
|
Yes, your assessment of the This doesn't fix the length issue On Wed, Feb 10, 2016 at 11:51 AM, Phil Estes notifications@github.com
|
|
hmm, fat fingers.
Yes, your assessment of the `docker inspect` difference is right.
This does not fix the length issue - that is inherent to the idea that
`hostname` is an FQDN. we could add a `--domainname` cli flag, which
would empower CLi users as much as API users, but I didn't want to do
that without deeper consideration and use-cases. That is an easy
followup, though.
libcontainer doesn't really need to keep hostname and domainname
separate - all libcontainer cares about is what value to pass to
`syscall.Sethostname()` and that value is whatever the user passed as
`hostname` to CLI or API.
|
|
@thockin can you sign-off your commit? 😇 |
|
Now that the initial overall WIP has been floated for discussion, I would suggest the libnetwork PR can be created for review as well, and those 2 file changes dropped from this PR. Don't know if @mavenugo or others want to weigh in here, or wait for a libnetwork PR. I personally think this is a reasonable fix for a long-standing issue around hostname vs. fqdn. |
|
Thanks. I will prep a "real" patch against libnetwork and sign this and update docs On Thu, Feb 11, 2016 at 9:15 AM, Madhu Venugopal notifications@github.com
|
|
Some missing CI jobs here. They need kicking off again. Signing the commit and force pushing should resolve that. |
|
@thockin The change looks ok for fixing the API. But in the current form it breaks the existing behavior for net host. I think we can retain the current behavior by not splitting the os.Hostname() into host and domain name in initializeNetworking |
|
@sanimej re --net-host : Do you think it is sufficient to set the hostname and not the domainname? Or should we actually get the domainname (exec |
|
Also - thoughts on what docs need to be updated? |
|
@thockin For --net=host mode its sufficient to set only the hostname. This will cover the case where hostname is an fqdn. When the hostname is not an fqdn, /etc/hosts should typically have the fqdn. Since the /etc/hosts file is copied in the --net=host mode container should get the right dnsdomainname. |
|
@thaJeztah Can you please help in identifying the docs that need to be updated for this change ? I don't see hostname & fqdn being specifically discussed in any of the docs. But probably we have to update the API documentation to clarify the behavior ? |
|
@sanimej I'll have a look at the docs; from a design perspective, does this LGTY (the networking team?) if it does, we can move this forward to code review |
|
@thaJeztah Yes, This is a reasonable solution without adding any UI or API changes. There is one expected change in docker inspect output though; as mentioned earlier by @estesp
|
|
For the documentation, I think we need;
IIUC, the |
|
Rebased and test fixed, I think |
|
Thanks @thockin |
|
oh cr*p, @thockin looks like it needs another rebase already 😢 |
This allows users to provide a FQDN as hostname or to use distinct hostname and domainname parts. Depends on moby/libnetwork#950 Signed-off-by: Tim Hockin <thockin@google.com>
|
rebased On Tue, Mar 15, 2016 at 3:48 AM, Sebastiaan van Stijn <
|
|
LGTM. Thanks @thockin |
|
Anything I need to do regarding the failed windows tests? |
|
Can we "fix" the inspect output for older clients? |
|
@cpuguy83 I think I am out of my depth on that question. |
|
LGTM, let's move this forward to docs review. |
|
thanks, LGTM - not sure if there's anything else to document 😄 |
|
Docs LGTM too. |
Don't smoosh hostname and domainname in API
Fixes #14282
I think this is a better solution than #20196. Rather than make the CLI split
--hostname, let it happen at the backend. This preserve's the user's intentions all the way through. No API change needed. No behavioral change from the CLI. The results ofdocker inspectwill be different for--hostname=foo.bar.comcontainers, but the user-visible behavior is the same. The only behavioral change is for API users that specify bothhostnameanddomainname, in which case the container's hostname will just be thehostnamefield. Otherwise it behaves exactly the same.Tests and docs are not updated yet, pending someone saying they don't hate this. And yes, it obviously has to go into libnetwork, not here. I'll do all that if folks say this is OK.