File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,7 @@ Basic flags:
255255- :whale : ` --rm ` : Automatically remove the container when it exits
256256- :whale : ` --pull=(always|missing|never) ` : Pull image before running
257257 - Default: "missing"
258+ - :whale : ` --pid=(host) ` : PID namespace to use
258259
259260Network flags:
260261- :whale : ` --net, --network=(bridge|host|none|<CNI>) ` : Connect a container to a network
Original file line number Diff line number Diff line change @@ -131,6 +131,11 @@ var runCommand = &cli.Command{
131131 Aliases : []string {"m" },
132132 Usage : "Memory limit" ,
133133 },
134+ // Enable host pid namespace
135+ & cli.StringFlag {
136+ Name : "pid" ,
137+ Usage : "PID namespace to use" ,
138+ },
134139 & cli.IntFlag {
135140 Name : "pids-limit" ,
136141 Usage : "Tune container pids limit (set -1 for unlimited)" ,
@@ -484,6 +489,15 @@ func runAction(clicontext *cli.Context) error {
484489 opts = append (opts , oci .WithDevShmSize (shmBytes / 1024 ))
485490 }
486491
492+ pidNs := strings .ToLower (clicontext .String ("pid" ))
493+ if pidNs != "" {
494+ if pidNs != "host" {
495+ return fmt .Errorf ("Invalid pid namespace. Set --pid=host to enable host pid namespace." )
496+ } else {
497+ opts = append (opts , oci .WithHostNamespace (specs .PIDNamespace ))
498+ }
499+ }
500+
487501 rtCOpts , err := generateRuntimeCOpts (clicontext )
488502 if err != nil {
489503 return err
You can’t perform that action at this time.
0 commit comments