diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-10-20 15:18:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-20 15:18:53 -0400 |
commit | 6961b9475dbcbc6112d9c6022ac264c923ce083d (patch) | |
tree | 5536944fef8861aef90873b9687730262a2dcebc /pkg/specgen | |
parent | 36682115b0f3f5f7cfcc6bc4580e5a7435b9a4d8 (diff) | |
parent | 1b288a35ba931c0b524af550749a7c1fd48b452f (diff) | |
download | podman-6961b9475dbcbc6112d9c6022ac264c923ce083d.tar.gz podman-6961b9475dbcbc6112d9c6022ac264c923ce083d.tar.bz2 podman-6961b9475dbcbc6112d9c6022ac264c923ce083d.zip |
Merge pull request #8067 from mheon/net_host_hosts
Ensure that hostname is added to hosts with net=host
Diffstat (limited to 'pkg/specgen')
-rw-r--r-- | pkg/specgen/generate/namespaces.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/specgen/generate/namespaces.go b/pkg/specgen/generate/namespaces.go index 7adb8be6a..7e4f09dc4 100644 --- a/pkg/specgen/generate/namespaces.go +++ b/pkg/specgen/generate/namespaces.go @@ -342,7 +342,7 @@ func specConfigureNamespaces(s *specgen.SpecGenerator, g *generate.Generator, rt return errors.Wrapf(err, "error looking up container to share uts namespace with") } hostname = utsCtr.Hostname() - case s.NetNS.NSMode == specgen.Host || s.UtsNS.NSMode == specgen.Host: + case (s.NetNS.NSMode == specgen.Host && hostname == "") || s.UtsNS.NSMode == specgen.Host: tmpHostname, err := os.Hostname() if err != nil { return errors.Wrap(err, "unable to retrieve hostname of the host") |