Skip to content

Commit 0a3a77b

Browse files
authored
Merge pull request #5604 from ktock/nvidiacgroups
Allow to pass --no-cgroups option to nvidia-container-cli
2 parents fdfe01d + 9c01fe2 commit 0a3a77b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

contrib/nvidia/nvidia.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ type config struct {
111111
LDConfig string
112112
Requirements []string
113113
OCIHookPath string
114+
NoCgroups bool
114115
}
115116

116117
func (c *config) args() []string {
@@ -137,6 +138,9 @@ func (c *config) args() []string {
137138
for _, r := range c.Requirements {
138139
args = append(args, fmt.Sprintf("--require=%s", r))
139140
}
141+
if c.NoCgroups {
142+
args = append(args, "--no-cgroups")
143+
}
140144
args = append(args, "--pid={{pid}}", "{{rootfs}}")
141145
return args
142146
}
@@ -209,3 +213,9 @@ func WithLookupOCIHookPath(name string) Opts {
209213
return nil
210214
}
211215
}
216+
217+
// WithNoCgroups passes --no-cgroups option to nvidia-container-cli.
218+
func WithNoCgroups(c *config) error {
219+
c.NoCgroups = true
220+
return nil
221+
}

0 commit comments

Comments
 (0)