Merge pull request #857 from crosbymichael/host
Add --net-host for testing host networking
This commit is contained in:
commit
615f748e77
@ -51,6 +51,10 @@ var runCommand = cli.Command{
|
|||||||
Name: "readonly",
|
Name: "readonly",
|
||||||
Usage: "set the containers filesystem as readonly",
|
Usage: "set the containers filesystem as readonly",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "net-host",
|
||||||
|
Usage: "enable host networking for the container",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Action: func(context *cli.Context) error {
|
Action: func(context *cli.Context) error {
|
||||||
var (
|
var (
|
||||||
|
@ -92,7 +92,7 @@ func spec(id string, config *ocispec.ImageConfig, context *cli.Context) (*specs.
|
|||||||
if cwd == "" {
|
if cwd == "" {
|
||||||
cwd = "/"
|
cwd = "/"
|
||||||
}
|
}
|
||||||
return &specs.Spec{
|
s := &specs.Spec{
|
||||||
Version: specs.Version,
|
Version: specs.Version,
|
||||||
Platform: specs.Platform{
|
Platform: specs.Platform{
|
||||||
OS: runtime.GOOS,
|
OS: runtime.GOOS,
|
||||||
@ -211,12 +211,15 @@ func spec(id string, config *ocispec.ImageConfig, context *cli.Context) (*specs.
|
|||||||
{
|
{
|
||||||
Type: "mount",
|
Type: "mount",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Type: "network",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, nil
|
}
|
||||||
|
if !context.Bool("net-host") {
|
||||||
|
s.Linux.Namespaces = append(s.Linux.Namespaces, specs.LinuxNamespace{
|
||||||
|
Type: "network",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return s, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func customSpec(configPath string, rootfs string) (*specs.Spec, error) {
|
func customSpec(configPath string, rootfs string) (*specs.Spec, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user