To begin, here is a simple plan of my problem:
Connect to 192.168.0.20:4200 — front container send request to middle container —> 172.17.0.2:8080 —-> Middle receive and send to database –> 172.17.0.3:1433
— Database answer to middle –> 172.17.0.2:8080 — Middle send to the front –> 172.17.0.4:4200
I have a problem to connect a front and a middle application in a docker positionned inside a synology NAS. Who works if I use docker locally.
First at all, I’ve a mssql database based on 172.17.0.3:1433
I can connect to it with SSMS.
Then, I have a middle application on 172.17.0.2 8080:8080 I can verify that it works because I have a flyway inside who can creates the database. So, when I run the middle, it creates the table.
Then, I try to test a request with Postman. Locally, the nas has the adress 192.168.0.20. So I run a simple GET request to the middle:
It works and I receive a Json.
Then, I create a front container (Angular Api) who is based on 172.17.0.4. Usually, I run this application locally on port 4200.
So I’ve make this Docker file:
FROM nginx:alpine COPY /dist/api-front /usr/share/nginx/html EXPOSE 4200
Then, I build the container and I send an image of this build to the docker inside the NAS.
First problem: when I create the container, I absolutely don’t know why, but Docker try to use the port 80:
And I have absolutely no port 80 mentionned in this application! I know that the Synology NAS are configured to use the port 80 for the websites but I didn’t have this problem with the middle and the back.
So I’ve tried to cut off the 80 port but it doesn"t work. If I turn it on and let the 4200 open, It works but without the request send to the middle!
Here is a sample request from the front to the middle (same as before but with the IP of the container this time):
The middle receive (I think, I hope) and send the request to the database in 172.17.0.3:1433
Then, the middle is supposed to send the answer to the front with this url:
But I have a time out… Do you know if the problem is due to the 80 port and if I have a way to change it?
Other question just in case: is there a way to test a request between two container directly from inside a Synology docker?
Thanks for your help!
Source: Docker Questions