I have three containers :
- front (vuejs)
- server (nodejs)
- mongo (mongodb)
Communication between server <-> mongo is OK but communication between front -> server is KO (a front http call to server cannot reach).
Here my docker-compose :
version: "3.3"
services:
server:
build:
context: ../server
command: nodemon ../server/bin/www
volumes:
- ../server:/server
ports:
- "3000:3000"
networks:
- frontend
- backend
depends_on:
- mongo
front:
build:
context: ../front
command: npm run dev
volumes:
- ../front:/app
ports:
- "8081:8081"
networks:
- frontend
depends_on:
- server
mongo:
image: mongo:3.6.5
ports:
- "27017:27017"
networks:
- backend
environment:
MONGO_INITDB_DATABASE: mongo-dev
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: password
command: mongod
networks:
frontend:
backend:
Running docker-compose up is OK : Mongo is created + server is running + front is running.
I can access them from my browser (http://localhost:3000 for server + http://localhost:8081 for front) but impossible for my front to get a simple http GET to my server with
http://server:3000/myGetRoute
Note : this route is reachable from my browser with
http://localhost:3000/myGetRoute
and ping server from my front container is OK.
Communication from front -> server is impossible. Any idea ?
EDIT : my front service running on : http://0.0.0.0:8081)