I am new in Web development, and now I got some obstacles bothering me a couple of days. I successfully built my web app by docker-compose locally.
Then I tried to use docker-compose to run my both front and backend on EC2 Linux instance.
However, although now the frontend was showing publicly, but now unable to GET the data from my backend. Got an error message: " net::ERR_CONNECTION_REFUSED". Looks like my the connection between front and back is broken.
I am wondering since the docker-compose.yaml is running successfully on local. It should also be working on the EC2 instance?
Any suggestion would be helpful. Thank you.
Docker-Compose.yaml:
Version: "3.2"
services:
project:
restart: always
container_name: coin
command : bash -c "python manage.py runserver 0.0.0.0:8000"
build:
context: ./coin_api/
dockerfile: dockerfile
ports:
- "8000:8000"
frontend:
restart: always
command : npm start
container_name: front
build:
context: ./frontend/
dockerfile: dockerfile
ports:
- "3000:3000"
stdin_open: true
networks:
db-net:
driver: bridge
Security Group of the EC2 Instance: