aboutsummaryrefslogtreecommitdiff
path: root/libpod/container.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-11-27 03:29:07 -0800
committerGitHub <noreply@github.com>2018-11-27 03:29:07 -0800
commit1d3e24239aa525640bcc9cef4864fb04d69143ed (patch)
treef159f155d93f73320a604d89d68f010397db72cb /libpod/container.go
parent39560500fcc504bea70d48759f44c64f680c2ef2 (diff)
parentbb6c1cf8d1667c7c8e4d539ea2250a18fa89a58a (diff)
downloadpodman-1d3e24239aa525640bcc9cef4864fb04d69143ed.tar.gz
podman-1d3e24239aa525640bcc9cef4864fb04d69143ed.tar.bz2
podman-1d3e24239aa525640bcc9cef4864fb04d69143ed.zip
Merge pull request #1734 from rhatdan/network
libpod should know if the network is disabled
Diffstat (limited to 'libpod/container.go')
-rw-r--r--libpod/container.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 7bb5b2687..16f61d021 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -996,3 +996,15 @@ func (c *Container) IsInfra() bool {
func (c *Container) IsReadOnly() bool {
return c.config.Spec.Root.Readonly
}
+
+// NetworkDisabled returns whether the container is running with a disabled network
+func (c *Container) NetworkDisabled() bool {
+ if !c.config.PostConfigureNetNS {
+ for _, ns := range c.config.Spec.Linux.Namespaces {
+ if ns.Type == spec.NetworkNamespace {
+ return ns.Path == ""
+ }
+ }
+ }
+ return false
+}