【踩坑】Docker部署PostgreSQL报错
前言
Docker部署PostgreSQL16时报错: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/16/bin/initdb"
Docker部署PostgreSQL14时报错: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/14/bin/initdb".
Docker部署PostgreSQL12时报错: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.
解决问题
- 改用Postgre11
-e POSTGRES_USER=postgres:配置用户名-e POSTGRES_PASSWORD=postgres:配置密码-e POSTGRES_DB=postgres:配置数据库名
1 | docker run -d --name immich-postgres -v /root/postgresql/data:/var/lib/postgresql/data -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres postgres:11 |