PostgreSQL Docker 部署常见问题与解决方案
汇总在使用 Docker 部署 PostgreSQL(含 PostGIS、pgvector、TimescaleDB)过程中常见的问题及可操作的解决方案,涵盖构建、扩展、连接、权限、性能与数据等方面。 目录 构建问题 扩展问题 连接问题 权限问题 性能问题 数据问题 调试技巧 预防措施 获取帮助 构建问题 Q1: Docker 构建时出现 “lsb_release: command not found” 问题描述: /bin/sh: 1: lsb_release: command not found /bin/sh: 1: apt-key: command not found 原因分析: 在 Debian/Ubuntu 基础镜像中,lsb_release 和 apt-key 命令可能不存在或已被弃用。 解决方案:改用从源码编译的方式安装 TimescaleDB: # 不使用包管理器安装,改为源码编译 RUN cd /tmp && \ git clone https://github.com/timescale/timescaledb.git && \ cd timescaledb && \ git checkout 2.13.0 && \ ./bootstrap && \ cd build && \ make && \ make install Q2: 编译时出现 “gssapi/gssapi.h: No such file or directory” 问题描述: ...