Cgroup error on container creation

Hi,
I face a cgroup configuration error when starting containers with docker compose up.

The error is:

Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: unable to apply cgroup configuration: mkdir /sys/fs/cgroup/memory/docker/9efee48270ea2c039d8fe00bd39a1bd5acc8fe905063b48539493ae808a65af9: cannot allocate memory: unknown

Docker has been working correctly for months on this server. I wanted to migrate a local path volume to another directory. When running the container again, I faced the error and could not restart it.
I tried to restart other containers running on my machine but most would not.
Pruning everything (docker system prune -a --volumes) would solve the problem for deploying the next one or two containers, but the error would appear again after.

I’m running debian 12 with kernel 4.19 and cgroup v1.

Those are the different steps I tried:

  • Setting systemd as the cgroup driver, was cgroupfs before
  • Reinstalling docker
  • Using an older docker version
  • Removed swap
  • Ulimit set to unlimited
  • No logs in journalctl -xe
  • Full apt upgrade

I spent a lot of time online but the few forums post or github issues I found are either unrelated or without answers.
Thanks

For anyone coming across this post :
My temporary solution was to create a systemd slice (systemctl edit docker.slice) without any limits and set it with the cgroup-parent docker setting in /etc/docker/daemon.json.