summaryrefslogtreecommitdiff
path: root/libpod/container_internal_linux.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-09-16 17:15:08 -0400
committerGitHub <noreply@github.com>2021-09-16 17:15:08 -0400
commit0acf540304b7d2f57357522e4fb47914b0b31a70 (patch)
treebfd2527bf2ebfd9ff18baa002b3cc6ce938b7edc /libpod/container_internal_linux.go
parenta65000bbb79d616cbd2172c4d86b9c8521b1cfab (diff)
parentf1ee234252768921313ddbbdbb7184585800bdbb (diff)
downloadpodman-0acf540304b7d2f57357522e4fb47914b0b31a70.tar.gz
podman-0acf540304b7d2f57357522e4fb47914b0b31a70.tar.bz2
podman-0acf540304b7d2f57357522e4fb47914b0b31a70.zip
Merge pull request #11605 from Luap99/hosts
Only add 127.0.0.1 entry to /etc/hosts with --net=none
Diffstat (limited to 'libpod/container_internal_linux.go')
-rw-r--r--libpod/container_internal_linux.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 0557b30d0..6ebbfd1f3 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -2033,15 +2033,16 @@ func (c *Container) getHosts() string {
// Do we have a network namespace?
netNone := false
- for _, ns := range c.config.Spec.Linux.Namespaces {
- if ns.Type == spec.NetworkNamespace {
- if ns.Path == "" && !c.config.CreateNetNS {
- netNone = true
+ if c.config.NetNsCtr == "" && !c.config.CreateNetNS {
+ for _, ns := range c.config.Spec.Linux.Namespaces {
+ if ns.Type == spec.NetworkNamespace {
+ if ns.Path == "" {
+ netNone = true
+ }
+ break
}
- break
}
}
-
// If we are net=none (have a network namespace, but not connected to
// anything) add the container's name and hostname to localhost.
if netNone {