The architecture of the app I planning to create consist of an React, Python and Firebird component. The React part will serve as front-end, the Python part will be the back-end which communicates with the Firebird DB. The React and Firebird component will run in Docker and has to communicate with a Firebird server, which runs locally on 127.0.0.1.
The current docker-compose file looks like the following:
version: "3.9"
services:
gui:
build:
context: gui
restart: always
ports:
- 80:80
depends_on:
- api
api:
build:
context: api
restart: always
ports:
- 8000:8000
- 3050:3050
volumes:
- C:/Program Files/Firebird/Firebird_2_5/examples/empbuild:/app/api/empbuild:rw
For connecting to the local Firebird server, the following code can be used:
import firebirdsql
conn = firebirdsql.connect(
host='127.0.0.1',
database='...',
port=3050,
user='sysdba',
password='masterkey'
)
So, I need to establish a connection to the local network within the docker container to 127.0.0.1:3050. Currently I'm getting the following error:
ConnectionRefusedError: [Errno 111] Connection refused
Which is due to that the Firebird service is running outside the container and is not mapped to the network of the docker containers. How can I establish this connection by having those two components communicating with the Local Firebird sever?