summaryrefslogtreecommitdiffhomepage
path: root/runsc/container/container.go
diff options
context:
space:
mode:
authorKonstantin Baranov <konstantin.baranov@workato.com>2020-10-06 15:34:02 -0700
committerKonstantin Baranov <konstantin.baranov@workato.com>2020-10-06 15:34:02 -0700
commita2a27eedf44303a60f580e03be617124ce35bb17 (patch)
tree9d75bc1bdc29f904ef86b7081c64c68c248ad444 /runsc/container/container.go
parent6321eccddce2b59976454799dcd25bc60ce5b0e8 (diff)
Ignore errors in rootless and test modes
Diffstat (limited to 'runsc/container/container.go')
-rw-r--r--runsc/container/container.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/runsc/container/container.go b/runsc/container/container.go
index 21a01b5de..878432dbb 100644
--- a/runsc/container/container.go
+++ b/runsc/container/container.go
@@ -327,7 +327,16 @@ func New(conf *boot.Config, args Args) (*Container, error) {
if cg != nil {
// If there is cgroup config, install it before creating sandbox process.
if err := cg.Install(args.Spec.Linux.Resources); err != nil {
- return nil, fmt.Errorf("configuring cgroup: %v", err)
+ switch {
+ case errors.Is(err, syscall.EROFS) && conf.TestOnlyAllowRunAsCurrentUserWithoutChroot:
+ log.Warningf("Skipping cgroup configuration in test mode: %v", err)
+ cg = nil
+ case errors.Is(err, syscall.EACCES) && conf.Rootless:
+ log.Warningf("Skipping cgroup configuration in rootless mode: %v", err)
+ cg = nil
+ default:
+ return nil, fmt.Errorf("configuring cgroup: %v", err)
+ }
}
}
if err := runInCgroup(cg, func() error {