mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #42331 from AkihiroSuda/dind-fix-cgroup2-evac
hack/dind: fix cgroup v2 evacuation with `docker run --init`
This commit is contained in:
commit
59751bb233
1 changed files with 3 additions and 2 deletions
|
@ -27,10 +27,11 @@ fi
|
||||||
|
|
||||||
# cgroup v2: enable nesting
|
# cgroup v2: enable nesting
|
||||||
if [ -f /sys/fs/cgroup/cgroup.controllers ]; then
|
if [ -f /sys/fs/cgroup/cgroup.controllers ]; then
|
||||||
# move the init process (PID 1) from the root group to the /init group,
|
# move the processes from the root group to the /init group,
|
||||||
# otherwise writing subtree_control fails with EBUSY.
|
# otherwise writing subtree_control fails with EBUSY.
|
||||||
|
# An error during moving non-existent process (i.e., "cat") is ignored.
|
||||||
mkdir -p /sys/fs/cgroup/init
|
mkdir -p /sys/fs/cgroup/init
|
||||||
echo 1 > /sys/fs/cgroup/init/cgroup.procs
|
xargs -rn1 < /sys/fs/cgroup/cgroup.procs > /sys/fs/cgroup/init/cgroup.procs || :
|
||||||
# enable controllers
|
# enable controllers
|
||||||
sed -e 's/ / +/g' -e 's/^/+/' < /sys/fs/cgroup/cgroup.controllers \
|
sed -e 's/ / +/g' -e 's/^/+/' < /sys/fs/cgroup/cgroup.controllers \
|
||||||
> /sys/fs/cgroup/cgroup.subtree_control
|
> /sys/fs/cgroup/cgroup.subtree_control
|
||||||
|
|
Loading…
Add table
Reference in a new issue