From 4299a5b7bf51ed423d7776f236defb419eff6abc Mon Sep 17 00:00:00 2001 From: penghanyuan Date: Sat, 14 Feb 2026 13:36:17 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=20Docker=20Compose?= =?UTF-8?q?=20=E9=85=8D=E7=BD=AE=E4=BB=A5=E7=BB=91=E5=AE=9A=20PostgreSQL?= =?UTF-8?q?=20=E7=AB=AF=E5=8F=A3=E5=88=B0=20localhost?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改 docker-compose.yml,将 PostgreSQL 端口绑定到 localhost,以便通过 SSH 隧道访问,增强安全性。 --- api/docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/docker-compose.yml b/api/docker-compose.yml index ad65777..9471a84 100644 --- a/api/docker-compose.yml +++ b/api/docker-compose.yml @@ -5,8 +5,8 @@ services: postgres: image: postgres:17-alpine container_name: life-echo-postgres - # ports: - # - "5432:5432" # 不暴露到宿主机,仅在 Docker 网络内部访问 + ports: + - "127.0.0.1:5432:5432" # 仅绑定 localhost,通过 SSH 隧道访问 environment: POSTGRES_USER: ${POSTGRES_USER:-postgres} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}