如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
注意: 此镜像的描述超出了Hub的25000字符限制,因此已被截断。完整描述可在https://github.com/docker-library/docs/tree/master/postgres/README.md%E6%9F%A5%E7%9C%8B%E3%80%82%E5%8F%A6%E8%AF%B7%E5%8F%82%E9%98%85https://github.com/docker/hub-feedback/issues/238%E5%92%8Chttps://github.com/docker/roadmap/issues/475%E3%80%82
注意: 这是https://hub.docker.com/_/postgres%E7%9A%84%60amd64%60%E6%9E%B6%E6%9E%84%E6%9E%84%E5%BB%BA%E7%9A%84%22%E6%AF%8F%E6%9E%B6%E6%9E%84%22%E4%BB%93%E5%BA%93%E2%80%94%E2%80%94%E6%9B%B4%E5%A4%9A%E4%BF%A1%E6%81%AF%EF%BC%8C%E8%AF%B7%E5%8F%82%E9%98%85%E5%AE%98%E6%96%B9%E9%95%9C%E5%83%8F%E6%96%87%E6%A1%A3%E4%B8%AD%E7%9A%84https://github.com/docker-library/official-images#architectures-other-than-amd64%E5%92%8C%E5%AE%98%E6%96%B9%E9%95%9C%E5%83%8FFAQ%E4%B8%AD%E7%9A%84https://github.com/docker-library/faq#an-images-source-changed-in-git-now-what%E3%80%82
维护者:
https://github.com/docker-library/postgres
获取帮助:
Docker社区Slack、Server Fault、Unix & Linux或Stack Overflow
Dockerfile链接https://github.com/docker-library/postgres/blob/22ca5c8d8e4b37bece4d38dbce1a060583b5308a/18/trixie/Dockerfile
https://github.com/docker-library/postgres/blob/22ca5c8d8e4b37bece4d38dbce1a060583b5308a/18/bookworm/Dockerfile
https://github.com/docker-library/postgres/blob/2c751341b6454412f2048de021a1f***de/18/alpine3.22/Dockerfile
https://github.com/docker-library/postgres/blob/2c751341b6454412f2048de021a1f***de/18/alpine3.21/Dockerfile
https://github.com/docker-library/postgres/blob/87e6f65859a53d10c5170a587def1bfc882d3830/17/trixie/Dockerfile
https://github.com/docker-library/postgres/blob/87e6f65859a53d10c5170a587def1bfc882d3830/17/bookworm/Dockerfile
https://github.com/docker-library/postgres/blob/2c751341b6454412f2048de021a1f***de/17/alpine3.22/Dockerfile
https://github.com/docker-library/postgres/blob/2c751341b6454412f2048de021a1f***de/17/alpine3.21/Dockerfile
https://github.com/docker-library/postgres/blob/a2433755c76d294477c85945d68944f8cdb7cf4b/16/trixie/Dockerfile
https://github.com/docker-library/postgres/blob/a2433755c76d294477c85945d68944f8cdb7cf4b/16/bookworm/Dockerfile
https://github.com/docker-library/postgres/blob/2c751341b6454412f2048de021a1f***de/16/alpine3.22/Dockerfile
https://github.com/docker-library/postgres/blob/2c751341b6454412f2048de021a1f***de/16/alpine3.21/Dockerfile
https://github.com/docker-library/postgres/blob/a2433755c76d294477c85945d68944f8cdb7cf4b/15/trixie/Dockerfile
https://github.com/docker-library/postgres/blob/a2433755c76d294477c85945d68944f8cdb7cf4b/15/bookworm/Dockerfile
https://github.com/docker-library/postgres/blob/2c751341b6454412f2048de021a1f***de/15/alpine3.22/Dockerfile
https://github.com/docker-library/postgres/blob/2c751341b6454412f2048de021a1f***de/15/alpine3.21/Dockerfile
https://github.com/docker-library/postgres/blob/a2433755c76d294477c85945d68944f8cdb7cf4b/14/trixie/Dockerfile
https://github.com/docker-library/postgres/blob/a2433755c76d294477c85945d68944f8cdb7cf4b/14/bookworm/Dockerfile
https://github.com/docker-library/postgres/blob/2c751341b6454412f2048de021a1f***de/14/alpine3.22/Dockerfile
https://github.com/docker-library/postgres/blob/2c751341b6454412f2048de021a1f***de/14/alpine3.21/Dockerfile
https://github.com/docker-library/postgres/blob/a2433755c76d294477c85945d68944f8cdb7cf4b/13/trixie/Dockerfile
https://github.com/docker-library/postgres/blob/a2433755c76d294477c85945d68944f8cdb7cf4b/13/bookworm/Dockerfile
https://github.com/docker-library/postgres/blob/2c751341b6454412f2048de021a1f***de/13/alpine3.22/Dockerfile
https://github.com/docker-library/postgres/blob/2c751341b6454412f2048de021a1f***de/13/alpine3.21/Dockerfile
问题反馈地址:
https://github.com/docker-library/postgres/issues?q=
支持的架构:(https://github.com/docker-library/official-images#architectures-other-than-amd64%EF%BC%89
https://hub.docker.com/r/amd64/postgres/%E3%80%81https://hub.docker.com/r/arm32v5/postgres/%E3%80%81https://hub.docker.com/r/arm32v6/postgres/%E3%80%81https://hub.docker.com/r/arm32v7/postgres/%E3%80%81https://hub.docker.com/r/arm64v8/postgres/%E3%80%81https://hub.docker.com/r/i386/postgres/%E3%80%81https://hub.docker.com/r/mips64le/postgres/%E3%80%81https://hub.docker.com/r/ppc64le/postgres/%E3%80%81https://hub.docker.com/r/riscv64/postgres/%E3%80%81https://hub.docker.com/r/s390x/postgres/
镜像 artifact 详情:
https://github.com/docker-library/repo-info/blob/master/repos/postgres%EF%BC%88https://github.com/docker-library/repo-info/commits/master/repos/postgres%EF%BC%89
(镜像元数据、传输大小等)
镜像更新:
https://github.com/docker-library/official-images/issues?q=label%3Alibrary%2Fpostgres
https://github.com/docker-library/official-images/blob/master/library/postgres%EF%BC%88https://github.com/docker-library/official-images/commits/master/library/postgres%EF%BC%89
本文档来源:
https://github.com/docker-library/docs/tree/master/postgres%EF%BC%88https://github.com/docker-library/docs/commits/master/postgres%EF%BC%89
PostgreSQL(通常简称为"Postgres")是一个对象关系型数据库管理系统(ORDBMS),强调可扩展性和标准合规性。作为数据库服务器,其主要功能是安全地存储数据并支持最佳实践,随后根据其他软件应用的请求检索数据,这些应用可能运行在同一台计算机上,也可能运行在网络(包括互联网)中的另一台计算机上。它可以处理从小型单机应用到具有大量并发用户的大型互联网应用的各种工作负载。最新版本还提供数据库本身的复制功能,以增强安全性和可扩展性。
PostgreSQL 实现了 SQL:2011 标准的大部分内容,支持 ACID 事务(包括大多数 DDL 语句),使用多版本并发控制(MVCC)避免锁定问题,提供脏读免疫和完全可串行化;使用许多其他数据库不具备的索引方法处理复杂 SQL 查询;支持可更新视图、物化视图、触发器、外键;支持函数和存储过程等扩展功能,并有大量第三方编写的扩展。除了能够与主要的专有和开源数据库协作外,PostgreSQL 通过广泛的标准 SQL 支持和可用的迁移工具支持从这些数据库迁移。如果使用了专有扩展,其可扩展性可以通过一些内置和第三方开源兼容性扩展(如 Oracle 兼容扩展)来模拟许多功能。
***.org/wiki/PostgreSQL
!https://raw.githubusercontent.com/docker-library/docs/01c***b2fe592c1f93a13b4e289ada0e3a1/postgres/logo.png
console$ docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d amd64/postgres
默认的 postgres 用户和数据库在入口点通过 initdb 创建。
postgres 数据库是一个默认数据库,供用户、工具和第三方应用使用。
postgresql.org/docs
psql 使用console$ docker run -it --rm --network some-network amd64/postgres psql -h some-postgres -U postgres psql (14.3) Type "help" for help. postgres=# SELECT 1; ?column? ---------- 1 (1 row)
postgres 的 compose.yaml 示例:
yaml# 使用 postgres/example 用户/密码凭据 services: db: image: postgres restart: always # 使用 docker compose 时设置共享内存限制 shm_size: 128mb # 或通过 swarm stack 部署时设置共享内存限制 #volumes: # - type: tmpfs # target: /dev/shm # tmpfs: # size: 134217728 # 128*2^20 字节 = 128Mb environment: POSTGRES_PASSWORD: example adminer: image: adminer restart: always ports: - 8080:8080
运行 docker compose up,等待完全初始化后,访问 http://localhost:8080 或 http://host-ip:8080(根据实际情况)。
有多种方式可以扩展 postgres 镜像。这里不尝试支持所有可能的用例,仅介绍一些我们认为有用的方式。
PostgreSQL 镜像使用多个容易被忽略的环境变量。唯一必需的变量是 POSTGRES_PASSWORD,其余为可选。
警告: 只有当您使用空数据目录启动容器时,Docker 特定变量才会生效;容器启动时,任何预先存在的数据库都将保持不变。
POSTGRES_PASSWORD此环境变量是使用 PostgreSQL 镜像所必需的。它不能为空或未定义。此环境变量设置 PostgreSQL 的超级用户密码。默认超级用户由 POSTGRES_USER 环境变量定义。
注意 1: PostgreSQL 镜像在本地设置了 trust 身份验证,因此您可能会注意到从 localhost(容器内部)连接时不需要密码。但是,如果从不同的主机/容器连接,则需要密码。
注意 2: 此变量定义 PostgreSQL 实例中的超级用户密码,由初始容器启动期间
以下是 amd64/postgres 相关的常用 Docker 镜像,适用于 关系型数据库、复杂查询、数据完整性 等不同场景:
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。


来自真实用户的反馈,见证轩辕镜像的优质服务