File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
libcontainer/capabilities Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 33package capabilities
44
55import (
6+ "errors"
67 "fmt"
78 "sort"
89 "strings"
910 "sync"
11+ "syscall"
1012
1113 "github.com/moby/sys/capability"
1214 "github.com/opencontainers/runc/libcontainer/configs"
@@ -129,9 +131,13 @@ func (c *Caps) ApplyCaps() error {
129131 // don't return any errors, only warn.
130132 ambs := c .caps [capability .AMBIENT ]
131133 err := capability .ResetAmbient ()
132- if err != nil {
133- return fmt .Errorf ("can't reset ambient capabilities: %w" , err )
134+
135+ // EINVAL is returned when the kernel doesn't support ambient capabilities.
136+ // We ignore this because runc supports running on older kernels.
137+ if err != nil && ! errors .Is (err , syscall .EINVAL ) {
138+ return err
134139 }
140+
135141 for _ , a := range ambs {
136142 err := capability .SetAmbient (true , a )
137143 if err != nil {
You can’t perform that action at this time.
0 commit comments