mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #22465 from allencloud/handle-error-when-getting-hostname-in-docker-info
handle error when getting hostname in info api
This commit is contained in:
commit
e16753ce19
1 changed files with 6 additions and 2 deletions
|
@ -133,9 +133,13 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
|||
v.CPUSet = sysInfo.Cpuset
|
||||
}
|
||||
|
||||
if hostname, err := os.Hostname(); err == nil {
|
||||
v.Name = hostname
|
||||
hostname := ""
|
||||
if hn, err := os.Hostname(); err != nil {
|
||||
logrus.Warnf("Could not get hostname: %v", err)
|
||||
} else {
|
||||
hostname = hn
|
||||
}
|
||||
v.Name = hostname
|
||||
|
||||
return v, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue