【发布时间】:2019-05-03 11:38:35
【问题描述】:
我正在尝试迁移数据,但它总是找不到我的 postgreSQL。
version: '3'
services:
server:
build: ./server
ports:
- 3002:3002
depends_on:
- db
environment:
CORS_ALLOW_ORIGINS: http://localhost:8080,http://localhost:80
PORT: 3002
DEBUG: vuichoi*
DEBUG_HIDE_DATE: 1
SECRET_OR_PRIVATE_KEY: secret
SECRET_OR_PUBLIC_KEY: secret
DATABASE_URL: postgres://vuichoi:@db:5432/vuichoi #point the server container to the db container's IP address
command: bash -c "sequelize db:migrate && sequelize db:seed:all"
db:
ports:
- 5432:5432
environment:
POSTGRES_USER: vuichoi
POSTGRES_DB: vuichoi
image: postgres:10
config.json
{
"development": {
"username": "vuichoi",
"database": "vuichoi",
"host": "localhost",
"dialect": "postgres"
},
"test": {
"username": "vuichoi",
"password": "vuichoi",
"database": "database_test",
"host": "localhost",
"dialect": "postgres"
},
"production": {
"use_env_variable": "DATABASE_URL"
}
}
在 docker-compose up --build 之后 enter image description here
当我尝试迁移时:
【问题讨论】:
标签: node.js postgresql docker docker-compose