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.

2

There are 2 best solutions below

0
On BEST ANSWER

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

2
On

I've got it working with a different machine image

    machine:
      image: ubuntu-2004:2023.04.2

This might be useful link to check available images: https://circleci.com/developer/machine/image/ubuntu-2004