Add --privileged option to ctr run

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2018-04-04 12:30:20 +01:00
parent 062c3a00ef
commit 903191072e
No known key found for this signature in database
GPG Key ID: 609102888A2EE3F9
2 changed files with 7 additions and 0 deletions

View File

@ -68,6 +68,10 @@ var ContainerFlags = []cli.Flag{
Name: "net-host", Name: "net-host",
Usage: "enable host networking for the container", Usage: "enable host networking for the container",
}, },
cli.BoolFlag{
Name: "privileged",
Usage: "run privileged container",
},
cli.BoolFlag{ cli.BoolFlag{
Name: "read-only", Name: "read-only",
Usage: "set the containers filesystem as readonly", Usage: "set the containers filesystem as readonly",

View File

@ -103,6 +103,9 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
if context.Bool("tty") { if context.Bool("tty") {
opts = append(opts, oci.WithTTY) opts = append(opts, oci.WithTTY)
} }
if context.Bool("privileged") {
opts = append(opts, oci.WithPrivileged)
}
if context.Bool("net-host") { if context.Bool("net-host") {
opts = append(opts, oci.WithHostNamespace(specs.NetworkNamespace), oci.WithHostHostsFile, oci.WithHostResolvconf) opts = append(opts, oci.WithHostNamespace(specs.NetworkNamespace), oci.WithHostHostsFile, oci.WithHostResolvconf)
} }