Changing SHM Size for PostgreSQL in a Docker Container
If you are having issues like time outs when querying data within any application from PostgreSQL instance running locally in a Docker container, you are probably running into memory allocation issue set by the Docker container which defaults to 64MB.
You can update the SHM (shared memory) by adding the
shm_size variable to the Docker compose file and set it to something larger than 64MB.
shm_size: 512MB to your Docker compose for PostgreSQL service and restart your instances using the
docker-compose.yml file. If you want to check if the SHM change happened, you can use the interactive shell to check this by typing
docker exec -it <container_id> df -h | grep shm.