Reputation: 391
I have the following Dockerfile
FROM python:3.12
RUN <<EOF
apt-get update
apt-get install -y cgroup-tools
EOF
WORKDIR /opt
COPY main.py main.py
CMD [ "python", "main.py" ]
Inside "main.py", I have this line
env_uuid = uuid.uuid4()
cgroup_name = f"exec_env_{env_uuid}"
subprocess.run(["cgcreate", "-g", f"memory:/{cgroup_name}"], check=True)
When I run it, with the command
docker buildx build --progress=plain --tag mytag . && docker run --privileged mytag
I get the error
cgcreate: can't create cgroup /exec_env_181a6832-1bba-4a3e-b3e8-2209cddd90ca: Device or resource busy
My question is: Is it possible to create cgroups within a Docker container? If so, what is needed?
Upvotes: 2
Views: 257