I have 2 docker composes , one is Infrastructures and the second is Appplications.
I need a direct line from Appplications => Infrastructures , to run migrations on a Postresql container in Appplications
docker ,and it (Infrastructures) must be listening before make requests from Appplications
.
Infrastructures :
version: "3"
networks:
shared_network:
driver: bridge
services:
# PostgreSQL
my_postgres:
image: postgres:latest
environment:
.... // ENVS
ports:
- "5432:5432"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5432"]
interval: 30s
timeout: 10s
retries: 15
networks:
- shared_network
... more infrastructures
Applications :
version: "3"
networks:
shared_network:
driver: bridge
services:
# Employees Service
emps:
build:
context: ./emps_service
dockerfile: ./Dockerfile
ports:
- "9000:9000"
networks:
- shared_network
... More apps
I'm using default.yaml for Sequelize :
... more definitions
sequelize:
database: some_random_db
host: my_postgres
user: xxxx
password: yyyy
dialect: postgres
seederStorage: "sequelize"
and when I run docker-compose up
, twice , first for the Infrastructures , and only once it's up another docker-compose up
for the Applications , I get :
**SequelizeHostNotFoundError: getaddrinfo ENOTFOUND my_postgres**
How can we fix this ?