PG启动报错

[root@localhost data]# docker logs postgres
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 pull postgres:bullseye

拉取镜像

docker pull postgres:12.17-bullseye

启动镜像

docker run --name postgres1217 -e POSTGRES_PASSWORD=PGdata@456  -p 5432:5432 -v /data/postgres/postgresql/data:/var/lib/postgresql/data -d postgres:12.17-bullseye

查看容器状态

docker ps -a

开放端口

firewall-cmd --add-port=5432/tcp

firewall-cmd --add-port=5432/tcp --permanent

链接测试

在这里插入图片描述

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐