mirror of
https://github.com/opencontainers/runc.git
synced 2025-10-05 07:27:03 +08:00

For "make integration", the tests are run inside a Docker/Podman container. Problem is, if cgroup v2 is used, the in-container /sys/fs/cgroup/cgroup.subtree_control is empty. The added script, used as Docker entrypoint, moves the current process into a sub-cgroup, and then adds all controllers in top-level cgroup.subtree_control. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
18 lines
527 B
Bash
Executable File
18 lines
527 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# This script is used from ../Dockerfile as the ENTRYPOINT. It sets up cgroup
|
|
# delegation for cgroup v2 to make sure runc tests can be properly run inside
|
|
# a container.
|
|
|
|
# Only do this for cgroup v2.
|
|
if [ -f /sys/fs/cgroup/cgroup.controllers ]; then
|
|
set -x
|
|
# Move the current process to a sub-cgroup.
|
|
mkdir /sys/fs/cgroup/init
|
|
echo 0 >/sys/fs/cgroup/init/cgroup.procs
|
|
# Enable all controllers.
|
|
sed 's/\b\w/+\0/g' <"/sys/fs/cgroup/cgroup.controllers" >"/sys/fs/cgroup/cgroup.subtree_control"
|
|
fi
|
|
|
|
exec "$@"
|