summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-06-05 09:41:26 -0400
committerGitHub <noreply@github.com>2020-06-05 09:41:26 -0400
commitf2432335ef1be0a6a4482354e3c288381127ee49 (patch)
tree57940c3e3b9aa2d7626a513d6c0184a6137f0954 /libpod
parent2f2ffd8678587db040ae76ef0231669ee19a5175 (diff)
parent9be0d759b8dc6f1f5967d511c85924cd923b5ae6 (diff)
downloadpodman-f2432335ef1be0a6a4482354e3c288381127ee49.tar.gz
podman-f2432335ef1be0a6a4482354e3c288381127ee49.tar.bz2
podman-f2432335ef1be0a6a4482354e3c288381127ee49.zip
Merge pull request #6498 from mheon/fix_pod_hostname
Ensure that containers in pods properly set hostname
Diffstat (limited to 'libpod')
-rw-r--r--libpod/pod.go5
-rw-r--r--libpod/pod_api.go2
2 files changed, 6 insertions, 1 deletions
diff --git a/libpod/pod.go b/libpod/pod.go
index 34ceef5ef..8afaa6052 100644
--- a/libpod/pod.go
+++ b/libpod/pod.go
@@ -171,6 +171,11 @@ func (p *Pod) SharesCgroup() bool {
return p.config.UsePodCgroupNS
}
+// Hostname returns the hostname of the pod.
+func (p *Pod) Hostname() string {
+ return p.config.Hostname
+}
+
// CgroupPath returns the path to the pod's CGroup
func (p *Pod) CgroupPath() (string, error) {
p.lock.Lock()
diff --git a/libpod/pod_api.go b/libpod/pod_api.go
index 0be9f2573..e2c4b515d 100644
--- a/libpod/pod_api.go
+++ b/libpod/pod_api.go
@@ -490,7 +490,7 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) {
Namespace: p.Namespace(),
Created: p.CreatedTime(),
State: podState,
- Hostname: "",
+ Hostname: p.config.Hostname,
Labels: p.Labels(),
CreateCgroup: false,
CgroupParent: p.CgroupParent(),