File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -255,6 +255,7 @@ Basic flags:
255
255
- :whale : ` --rm ` : Automatically remove the container when it exits
256
256
- :whale : ` --pull=(always|missing|never) ` : Pull image before running
257
257
- Default: "missing"
258
+ - :whale : ` --pid=(host) ` : PID namespace to use
258
259
259
260
Network flags:
260
261
- :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{
131
131
Aliases : []string {"m" },
132
132
Usage : "Memory limit" ,
133
133
},
134
+ // Enable host pid namespace
135
+ & cli.StringFlag {
136
+ Name : "pid" ,
137
+ Usage : "PID namespace to use" ,
138
+ },
134
139
& cli.IntFlag {
135
140
Name : "pids-limit" ,
136
141
Usage : "Tune container pids limit (set -1 for unlimited)" ,
@@ -484,6 +489,15 @@ func runAction(clicontext *cli.Context) error {
484
489
opts = append (opts , oci .WithDevShmSize (shmBytes / 1024 ))
485
490
}
486
491
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
+
487
501
rtCOpts , err := generateRuntimeCOpts (clicontext )
488
502
if err != nil {
489
503
return err
You can’t perform that action at this time.
0 commit comments