I ran into this error when using podman-compose to setup a Postgres container. This issue only happened on a MacOS machine, but it could be more general. The fix was to increase the amount of memory used by the podman VM:
podman machine stop
podman machine set --memory $desired_memory_in_MB
podman machine start
Usually the error message will include some number of bytes it tried to allocate for shared_buffers
, so set $desired_memory_in_MB
to something larger than that.
Additionally, you can limit the amount of memory consumed by the container by adding limits to the command
section of your docker-compose.yml
db:
image: "docker.io/postgres:16.1-alpine"
...
command:
- "postgres"
- "-c"
- "shared_buffers=2G"
[1] - Increase Podman memory limit
[2] - How to customize the configuration file of the official PostgreSQL Docker image?