Skip to content

Commit c3d20e7

Browse files
author
Ma Shimiao
committed
Fixes #1585 config.Namespaces is empty when accessed
Signed-off-by: Ma Shimiao <[email protected]>
1 parent deb9d7f commit c3d20e7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

libcontainer/specconv/spec_linux.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,6 @@ func CreateLibcontainerConfig(opts *CreateOpts) (*configs.Config, error) {
184184
}
185185

186186
exists := false
187-
if config.Namespaces.Contains(configs.NEWNET) {
188-
config.Networks = []*configs.Network{
189-
{
190-
Type: "loopback",
191-
},
192-
}
193-
}
194187
for _, m := range spec.Mounts {
195188
config.Mounts = append(config.Mounts, createLibcontainerMount(cwd, m))
196189
}
@@ -221,6 +214,13 @@ func CreateLibcontainerConfig(opts *CreateOpts) (*configs.Config, error) {
221214
}
222215
config.Namespaces.Add(t, ns.Path)
223216
}
217+
if config.Namespaces.Contains(configs.NEWNET) {
218+
config.Networks = []*configs.Network{
219+
{
220+
Type: "loopback",
221+
},
222+
}
223+
}
224224
config.MaskPaths = spec.Linux.MaskedPaths
225225
config.ReadonlyPaths = spec.Linux.ReadonlyPaths
226226
config.MountLabel = spec.Linux.MountLabel

0 commit comments

Comments
 (0)