...
1#!/bin/bash
2#
3# This script is used from ../Dockerfile as the ENTRYPOINT. It sets up cgroup
4# delegation for cgroup v2 to make sure runc tests can be properly run inside
5# a container.
6
7# Only do this for cgroup v2.
8if [ -f /sys/fs/cgroup/cgroup.controllers ]; then
9 set -x
10 # Move the current process to a sub-cgroup.
11 mkdir /sys/fs/cgroup/init
12 echo 0 >/sys/fs/cgroup/init/cgroup.procs
13 # Enable all controllers.
14 sed 's/\b\w/+\0/g' <"/sys/fs/cgroup/cgroup.controllers" >"/sys/fs/cgroup/cgroup.subtree_control"
15fi
16
17exec "$@"
View as plain text