You need to create a privileged container, with SYS_PTRACE capabilities and host PID, so you can access all the PIDs in the host (in my case, Colima VM).
docker run --privileged --cap-add=SYS_PTRACE --pid=host --name gdb-docker -it ubuntu:latest bash
Within the container:
apt update && apt install -y gdb
Then for gdb-heap
apt-get install -y libc6-dev libc6-dbg python3-gi libglib2.0-dev python3-ply python3-dbg