使用 Docker Compose部署的,我改成自己的数据库信息总是报错连不上…
Docker Compose
services:
new-api:
image: calciumion/new-api:latest
container_name: new-api
restart: always
command: --log-dir /app/logs
ports:
- "127.0.0.1:3111:3000"
volumes:
- ./data:/data
- ./logs:/app/logs
environment:
# 修改为服务器上MySQL的连接信息,格式为:用户名:密码@tcp(主机地址:端口)/数据库名
- SQL_DSN=root:密码@tcp(127.0.0.1:3306)/new-api
# 修改为服务器上Redis的连接信息,格式为:redis://主机地址:端口
- REDIS_CONN_STRING=redis://:redis_kyRrJE@//127.0.0.1:6379/0
- TZ=Asia/Shanghai
network_mode: bridge
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://localhost:3111/api/status | grep -o '\"success\":\\s*true' | awk -F: '{print $$2}'"]
interval: 30s
timeout: 10s
retries: 3
# 移除了原有的 redis 和 mysql 服务定义