はじめに
TIS社のハンズオンをやっているときに、dockerコンテナのPostgreSQL起動時にエラーが発生して作業が少し止まったので、エラー対処をここに載せておきます。
エラー内容
popen failure: Cannot allocate memory
initdb: error: The program "postgres" is needed by initdb but was not found in the
same directory as "/usr/lib/postgresql/12/bin/initdb".
Check your installation.
エラー対処
docker-compose.dev.yml の中身の image: postgres:12 を image: postgres:12-bullseye に修正すれば、正常に起動しました。
% docker-compose -f docker/docker-compose.dev.yml ps
Name Command State Ports
----------------------------------------------------------------------------------
docker_postgres_1 docker-entrypoint.sh postgres Up 0.0.0.0:5432->5432/tcp