Merge pull request #157 from crosbymichael/network-info

Only add network info if NEWNET is set
This commit is contained in:
Mrunal Patel 2015-07-27 16:50:29 -07:00
commit 6de84a5afc
1 changed files with 7 additions and 5 deletions

12
spec.go
View File

@ -191,11 +191,6 @@ func createLibcontainerConfig(spec *specs.LinuxSpec) (*configs.Config, error) {
Readonlyfs: spec.Root.Readonly, Readonlyfs: spec.Root.Readonly,
Hostname: spec.Hostname, Hostname: spec.Hostname,
Privatefs: true, Privatefs: true,
Networks: []*configs.Network{
{
Type: "loopback",
},
},
} }
for _, ns := range spec.Linux.Namespaces { for _, ns := range spec.Linux.Namespaces {
t, exists := namespaceMapping[ns.Type] t, exists := namespaceMapping[ns.Type]
@ -204,6 +199,13 @@ func createLibcontainerConfig(spec *specs.LinuxSpec) (*configs.Config, error) {
} }
config.Namespaces.Add(t, ns.Path) config.Namespaces.Add(t, ns.Path)
} }
if config.Namespaces.Contains(configs.NEWNET) {
config.Networks = []*configs.Network{
{
Type: "loopback",
},
}
}
for _, m := range spec.Mounts { for _, m := range spec.Mounts {
config.Mounts = append(config.Mounts, createLibcontainerMount(cwd, m)) config.Mounts = append(config.Mounts, createLibcontainerMount(cwd, m))
} }