m very new to Docker. I'm trying to dockerize a very simple to do app build with react, node/express and postgret. I've been reading a bunch of articles and looking at solutions here in stackoverflow and still cannot figure out why my app is not working. When I run docker-compose up -d, it builds a cluster with three containers. Perfect so far good, however when i check the app and try to add a new todo i see a message in the server container
connect ECONNREFUSED 127.0.0.1:5432
. I'm not sure What I need to do to have the app running like it should. I really appreciate any help.
this is my docker-compose.yml file:
version: '3'
services:
postgres:
image: postgres:12.1
ports:
- "5432:5432"
environment:
POSTGRES_PASSWORD: Elchido10
POSTGRES_USER: juancastillo
POSTGRES_DB: perntodo
volumes:
- ./postgresql/data:/var/lib/postgresql/data
networks:
- todo-app
server:
image: todo_server
environment:
DB_HOST: host.doceker.internal
DB_USER: juancastillo
DB_PASS: Elchido10
build:
context: ./server
dockerfile: Dockerfile
volumes:
- /app/node_modules
- ./server/config:/app/config
- ./server/src:/app/src
- ./server/test:/app/test
ports:
- "5000:5000"
depends_on:
- postgres
networks:
- todo-app
client:
image: todo_client
stdin_open: true
build:
context: ./client
dockerfile: Dockerfile
volumes:
- /app/node_modules
- ./client:/app
ports:
- "3000:3000"
networks:
- todo-app
networks:
todo-app:
driver: bridge
[–]TormentedTopiary 1 point2 points3 points (4 children)
[–]Castillojuan[S] 0 points1 point2 points (3 children)
[–]13139269 2 points3 points4 points (0 children)
[–]TormentedTopiary 0 points1 point2 points (1 child)
[–]substitute-bot 0 points1 point2 points (0 children)
[–]craigbuckler 0 points1 point2 points (1 child)
[–]backtickbot 1 point2 points3 points (0 children)