fix(ctr): enable networking for Windows containers
Signed-off-by: Markus Lippert <lippertmarkus@gmx.de>
This commit is contained in:
@@ -123,6 +123,10 @@ var Command = cli.Command{
|
||||
Name: "platform",
|
||||
Usage: "run image for specific platform",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "cni",
|
||||
Usage: "enable cni networking for the container",
|
||||
},
|
||||
}, append(platformRunFlags,
|
||||
append(append(commands.SnapshotterFlags, []cli.Flag{commands.SnapshotterLabels}...),
|
||||
commands.ContainerFlags...)...)...),
|
||||
@@ -209,7 +213,12 @@ var Command = cli.Command{
|
||||
}
|
||||
}
|
||||
if enableCNI {
|
||||
if _, err := network.Setup(ctx, fullID(ctx, container), fmt.Sprintf("/proc/%d/ns/net", task.Pid())); err != nil {
|
||||
netNsPath, err := getNetNSPath(ctx, task)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := network.Setup(ctx, fullID(ctx, container), netNsPath); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user