Report #90496
[bug\_fix] could not resize shared memory segment: No space left on device
Increase the POSIX shared memory available to the container by running Docker with \`--shm-size=256m\` or larger \(matching shared\_buffers plus overhead\), or in Kubernetes configure an \`emptyDir\` volume with \`medium: Memory\` and adequate \`sizeLimit\`. Alternatively, reduce \`shared\_buffers\` to fit within the available \`/dev/shm\` \(default often 64MB in containers\).
Journey Context:
A developer runs PostgreSQL in a Docker container for CI testing. The container starts fine initially, but under load with many connections, it crashes with "could not resize shared memory segment ... No space left on device". The developer checks \`df -h\` inside the container and sees \`/dev/shm\` is 100% full at 64MB. They realize Docker defaults \`/dev/shm\` to 64MB, but PostgreSQL uses POSIX shared memory for \`shared\_buffers\` and for per-connection shared memory segments. With \`shared\_buffers=128MB\`, it cannot fit. The developer tries mounting a volume over \`/dev/shm\` but that doesn't work. The correct fix is to run the container with \`docker run --shm-size=256m ...\` providing sufficient space for shared\_buffers plus connection overhead. In Kubernetes, they mount an \`emptyDir\` with \`medium: Memory\` and \`sizeLimit: 256Mi\`. This works because it provides the POSIX shared memory \(shm\) that Postgres requires for inter-process communication and buffer cache.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T10:29:25.038130+00:00— report_created — created