mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Only add network info if NEWNET is set
Only add the localhost interface information to the config if the NEWNET flag is passed on the namespaces. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -191,11 +191,6 @@ func createLibcontainerConfig(spec *specs.LinuxSpec) (*configs.Config, error) {
|
||||
Readonlyfs: spec.Root.Readonly,
|
||||
Hostname: spec.Hostname,
|
||||
Privatefs: true,
|
||||
Networks: []*configs.Network{
|
||||
{
|
||||
Type: "loopback",
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, ns := range spec.Linux.Namespaces {
|
||||
t, exists := namespaceMapping[ns.Type]
|
||||
@@ -204,6 +199,13 @@ func createLibcontainerConfig(spec *specs.LinuxSpec) (*configs.Config, error) {
|
||||
}
|
||||
config.Namespaces.Add(t, ns.Path)
|
||||
}
|
||||
if config.Namespaces.Contains(configs.NEWNET) {
|
||||
config.Networks = []*configs.Network{
|
||||
{
|
||||
Type: "loopback",
|
||||
},
|
||||
}
|
||||
}
|
||||
for _, m := range spec.Mounts {
|
||||
config.Mounts = append(config.Mounts, createLibcontainerMount(cwd, m))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user