Allow to pass --no-cgroup option to nvidia-container-cli

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
This commit is contained in:
ktock 2021-06-14 23:58:22 +09:00
parent fdfe01d7d3
commit 9c01fe20d3

View File

@ -111,6 +111,7 @@ type config struct {
LDConfig string LDConfig string
Requirements []string Requirements []string
OCIHookPath string OCIHookPath string
NoCgroups bool
} }
func (c *config) args() []string { func (c *config) args() []string {
@ -137,6 +138,9 @@ func (c *config) args() []string {
for _, r := range c.Requirements { for _, r := range c.Requirements {
args = append(args, fmt.Sprintf("--require=%s", r)) args = append(args, fmt.Sprintf("--require=%s", r))
} }
if c.NoCgroups {
args = append(args, "--no-cgroups")
}
args = append(args, "--pid={{pid}}", "{{rootfs}}") args = append(args, "--pid={{pid}}", "{{rootfs}}")
return args return args
} }
@ -209,3 +213,9 @@ func WithLookupOCIHookPath(name string) Opts {
return nil return nil
} }
} }
// WithNoCgroups passes --no-cgroups option to nvidia-container-cli.
func WithNoCgroups(c *config) error {
c.NoCgroups = true
return nil
}