惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

PCI Perspectives
PCI Perspectives
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
CXSECURITY Database RSS Feed - CXSecurity.com
P
Palo Alto Networks Blog
S
Schneier on Security
Scott Helme
Scott Helme
T
Threat Research - Cisco Blogs
K
Kaspersky official blog
Microsoft Azure Blog
Microsoft Azure Blog
T
The Exploit Database - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
G
GRAHAM CLULEY
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
I
Intezer
D
Docker
月光博客
月光博客
L
Lohrmann on Cybersecurity
Latest news
Latest news
B
Blog
罗磊的独立博客
M
MIT News - Artificial intelligence
S
Securelist
Know Your Adversary
Know Your Adversary
Help Net Security
Help Net Security
Recorded Future
Recorded Future
S
SegmentFault 最新的问题
N
Netflix TechBlog - Medium
T
Threatpost
H
Hacker News: Front Page
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
人人都是产品经理
人人都是产品经理
F
Fortinet All Blogs
博客园 - Franky
P
Proofpoint News Feed
大猫的无限游戏
大猫的无限游戏
Blog — PlanetScale
Blog — PlanetScale
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
A
About on SuperTechFans
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tor Project blog
Google Online Security Blog
Google Online Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Engineering at Meta
Engineering at Meta
Webroot Blog
Webroot Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Microsoft Security Blog
Microsoft Security Blog

宏尘极客

halo-theme-dream2.0-plus 主题-新版朋友圈配置说明 halo-theme-dream2.0-plus 主题 1.20.2 版本-留言板配置说明 微信红包封面-马到功成 Windows11彻底关闭自动更新指南 WSL2 Docker 资源配置指南 绿联Pro 安装Dos游戏中文版webui,一个可以浏览器内玩dos游戏的容器 绿联Pro 安装 Stirling-PDF-V2 - 强大的本地托管基于 Web 的 PDF 操作工具 绿联Pro 部署在线游戏机 绿联Pro 安装OpenList一个支持多种存储的文件列表程序 绿联Pro 部署Memos - 轻量级自托管备忘录中心 绿联Pro 安装 Stirling-PDF - 强大的本地托管基于 Web 的 PDF 操作工具 绿联Pro 部署Upage - 基于大模型的可视化网页构建平台,Lovable 开源替代 不蒜子数据同步工具使用指南 绿联Pro 自建不蒜子统计服务,替代Dream2.0 Plus主题页脚统计数据 1panel使用编排模板部署不蒜子服务,自建不蒜子统计服务,替代Dream2.0 Plus主题页脚统计数据 绿联Pro 安装Photopea,轻量在线PS工具 绿联Pro 安装禅道(Zentao),一款功能强大、全面的敏捷项目管理软件 绿联Pro 安装MeterSphere,新一代的测试管理和接口测试工具 Docker Compose 标签介绍与示例指南 绿联Pro 安装Meilisearch 搜索引擎,为halo博客提供增强搜索引擎 解析 <meta> 标签的全局 Referrer 策略设置 电线粗细选择与家用大功率电器布线指南 Nginx 防盗链配置介绍 Nginx 反向代理简介 绿联Pro 部署meting-api服务并使用lukcy反向代理,自建音乐API服务 1panel使用编排模板部署meting-api服务,自建音乐API服务 java开发 - 通过客户端访问接口获取接口服务器实际部署地址 Git revert 撤销已推送到服务器的提交详解 绿联Pro 部署MediaGo,跨平台视频提取工具 C# 自定义事件与委托 绿联Pro 安装Umami,使用MySQL数据库,为你的网站添加网站监控
绿联Pro 部署 PostgreSQL 数据库
宏尘 · 2025-09-17 · via 宏尘极客

PostgreSQL 是一款功能强大的开源关系型数据库管理系统,以其高性能、可靠性和扩展性著称。它支持复杂的查询、事务处理以及多种数据类型,同时具备良好的并发控制机制。PostgreSQL 持续演进,不断引入现代化特性,适用于从轻量级应用到大规模企业级系统的各类场景。

1、创建专属桥接网络

若已创建,可跳过此步骤。

https://www.hcjike.com/archives/tMUqkbKb

2、部署项目

2.1、创建项目

2.2、Compose配置

services:
  postgresql:
    container_name: postgresql
    image: postgres:latest
    restart: always
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD={强密码}
      - TZ=Asia/Shanghai
    ports:
      - 5432:5432
    volumes:
      - ./data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD", "pg_isready", "-h", "127.0.0.1", "-p", "5432", "-q", "-U", "postgres"]
      start_period: 20s
      interval: 30s
      retries: 5
      timeout: 5s
    networks:
      - app_network
networks:
  app_network:
    external: true
  • 设置“TZ”,值:“Asia/Shanghai”,将时区设置到+8时区,即北京时间;

  • POSTGRES_PASSWORD 要使用 PostgreSQL,需要此环境变量。它不能为空或未定义。此环境变量设置 PostgreSQL 的超级用户密码,{强密码}必须修改有效且复杂的密码,防止数据库被攻破;

  • POSTGRES_USER 此可选环境变量与设置用户及其密码结合使用。此变量将创建具有超级用户权限的指定用户和具有相同名称的数据库。如果未指定,则将使用默认用户:postgres

  • POSTGRES_DB 此可选环境变量可用于为首次启动映像时创建的默认数据库定义不同的名称。如果未指定,则将使用POSTGRES_USER的值。

在本示例中,POSTGRES_USER被设置为 postgres,因此超级管理员用户名为 postgres。由于未明确设置 POSTGRES_DB 的名称,默认数据库同样为 postgres。超级管理员密码为:{强密码}

注意:若修改了POSTGRES_USER的值,则必须将 test: ["CMD", "pg_isready", "-h", "127.0.0.1", "-p", "5432", "-q", "-U", "postgres"] 中的 "postgres" 替换为 POSTGRES_USER 所设置的用户名。