Merge pull request #8208 from estesp/7851-fix-hostname-fqdn

Provide full hostname with domainname to underlying container layer
Upstream-commit: 857b739e29be658dd08974cd81752257b1d6f386
Component: engine
This commit is contained in:
Victor Vieux
2014-09-25 11:33:50 -07:00
2 changed files with 26 additions and 1 deletions
+6 -1
View File
@@ -1043,10 +1043,15 @@ func (container *Container) setupLinkedContainers() ([]string, error) {
}
func (container *Container) createDaemonEnvironment(linkedEnv []string) []string {
// if a domain name was specified, append it to the hostname (see #7851)
fullHostname := container.Config.Hostname
if container.Config.Domainname != "" {
fullHostname = fmt.Sprintf("%s.%s", fullHostname, container.Config.Domainname)
}
// Setup environment
env := []string{
"PATH=" + DefaultPathEnv,
"HOSTNAME=" + container.Config.Hostname,
"HOSTNAME=" + fullHostname,
// Note: we don't set HOME here because it'll get autoset intelligently
// based on the value of USER inside dockerinit, but only if it isn't
// set already (ie, that can be overridden by setting HOME via -e or ENV