Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5952

Postgres container failed to start with initdb error. popen failure: Cannot allocate memory

$
0
0

I'm using postgres:12 Docker image on AWS instance under Ubuntu 20.04.

  postgres-tests:    image: "postgres:12"    restart: always    command: postgres -c 'max_connections=200'    environment:      POSTGRES_DB: "${POSTGRES_DATABASE}"      POSTGRES_USER: "${POSTGRES_USER}"      POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"    ports:      - "8396:5432"

When running this container with docker-compose up -d it fails to start with the following error:

postgres-tests_1  | popen failure: Cannot allocate memorypostgres-tests_1  | initdb: error: The program "postgres" is needed by initdb but was not found in thepostgres-tests_1  | same directory as "/usr/lib/postgresql/12/bin/initdb".postgres-tests_1  | Check your installation.

The error appeared suddenly after most-resent project deploy. The important thing is that the error happens only with this particular container. There is one more postgresql:12 container on the machine for another project, which works fine.

HERE IS WHAT I TRIED:

  1. I've found several suggestions related to increasing the shmall/shmmax params controlling shared memory on the machine.

But these system params are already set to high value:

ubuntu@ip-172-31-10-246:/var/www$ cat /proc/sys/kernel/shmall18446744073692774399ubuntu@ip-172-31-10-246:/var/www$ cat /proc/sys/kernel/shmmax18446744073692774399ubuntu@ip-172-31-10-246:/var/www$ 
  1. The second suggested option was to try a newer postgres image. Tested with postgres 13.0, 14.0 with no effect.UPDATETried with postgres:11 image and it runs OK, but I can not roll down postgres version in production, so it's not a solution in my case.

  2. I tried to stop/start and reboot the instance, also cleaning up docker cache with docker system prune and docker volumes prune.

Software:Ubuntu 20.04.2Docker version 20.10.8, build 3967b7dInstance hardware:Intel(R) Xeon(R) Platinum 8124M CPU @ 3.00GHz RAM:  4/8GB Used by system and other servicesSwap: 4.5/20GB Used by system and other services

Viewing all articles
Browse latest Browse all 5952

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>