Skip to content

Docker-in-docker - "sed: couldn't flush stdout: Device or resource" errors #660

@samruddhikhandale

Description

@samruddhikhandale

Tracks issues with docker startup due to sed: couldn't flush stdout: Device or resource errors. See https://github.com/devcontainers/features/actions/runs/5907721355/job/16026113620?pr=659#step:4:1968

Need to add a retry mechanism around this logic -->

set_cgroup_nesting()
{
# cgroup v2: enable nesting
if [ -f /sys/fs/cgroup/cgroup.controllers ]; then
# move the processes from the root group to the /init group,
# 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
xargs -rn1 < /sys/fs/cgroup/cgroup.procs > /sys/fs/cgroup/init/cgroup.procs || :
# enable controllers
sed -e 's/ / +/g' -e 's/^/+/' < /sys/fs/cgroup/cgroup.controllers \
> /sys/fs/cgroup/cgroup.subtree_control
fi
}
# Set cgroup nesting, retrying if necessary
set +e
set_cgroup_nesting
if [ $? -ne 0 ]; then
echo >&2 "cgroup v2: failed to enable nesting, retrying once..."
set -e
set_cgroup_nesting
fi
set -e

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions