postgresqlubuntudocker-composecirclecipostgresql-initdb

library/postgres Docker image fails to start with "popen failure: Cannot allocate memory"


I am using docker-compose on circleci to spin up a postgres container with a bunch of sql files mounted on /docker-entrypoint-initdb.d/. I am using an ubuntu machine image: ubuntu-2004:202010-01, but I am getting the error:

popen failure: Cannot allocate memory
initdb: error: program "postgres" is needed by initdb but was not found in the same directory as "/usr/lib/postgresql/15/bin/initdb"

This has always been woking, but at some point it stopped doing so. Any suggestion on what I can try? I already tried with some bigger resource_type (ie from medium to large) and some other ubuntu machine images.


Solution

  • All versions, including the latest one, are encountering this issue. I was stuck for nearly a day when I attempted to use this image 15-bullseye that solves the problem.

    This is the github open issue I got the solution: https://github.com/docker-library/postgres/issues/1099#issuecomment-1593228770