79201016

Date: 2024-11-18 18:28:52
Score: 1.5
Natty:
Report link

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

docker-compose.yml

  db:
    image: "docker.io/postgres:16.1-alpine"
    ...
    command:
      - "postgres"
      - "-c"
      - "shared_buffers=2G"

References

[1] - Increase Podman memory limit

[2] - How to customize the configuration file of the official PostgreSQL Docker image?

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: ijustlovemath