Open wisamidris7 opened 1 month ago
For containers to communicate, those must be connected to a common network. Compose creates one by default for this purpose, if you have no reason to set network1/network2 just remote all networks
declaration
I initially encountered issues not with SQL Server or myApp, but with gRPC communication between two applications within the same docker-compose setup.
My goal was to configure these applications for both HTTP/1 and HTTP/2 communication. However, I discovered that HTTP/1 and HTTP/2 require HTTPS or TLS for proper functionality.
In my ASP.NET Core project, which utilizes both gRPC and HTTP APIs, everything worked perfectly locally. But upon deploying to Docker, I encountered a problem: HTTP/2 is not supported, and HTTP/1 was required for gRPC calls from myapp1 to myapp2.
To address this, I configured myapp2 to use HTTPS with a domain name and certificate through Kestrel, setting HttpProtocol to Http1AndHttp2. While this configuration worked for requests from Chrome (using HTTP/1) and an empty gRPC console application (using HTTP/2), requests from myapp1 to myapp2 failed. They went through IP address-based communication and resulted in certificate validation errors due to the use of HTTPS.
I attempted to resolve this by changing the URL from https://myapp2:10000 to https://example.com:3912, but this led to timeout issues with gRPC requests. Additionally, I tried isolating each service in separate networks, but this did not resolve the issue.
I am also encountering similar problems when using reverse proxies like Nginx, as it does not seem to support HTTP/1 and HTTP/2 properly.
Given these challenges, I am concerned that this might be a Docker-related issue, especially since the problem persists even when services are in different networks. Any insights or suggestions would be greatly appreciated.
I honestly don't understand what you described here :'(
I suggest you don't try using dedicated network, just rely on Compose to set a default network so all services can communicate. Also ConnectionString
should not use an IP (which isn't predictable) but service name.
Description
How to make the communication for containers in the same dockers compose For example I have these containers
And networks written like this
And this is in ubuntu server so ipaddress was successfully working in Microsoft Sql Server Management Studio Also in empty console application inside the ubuntu server
And when calling it from myApp it was not working and gives me this error
And it should work because every one is in different network
NOTE:
This is ubuntu server server and its working in google cloud and sql server was accessible from my own computer
Steps To Reproduce
I did docker compose up Command to run it
Compose Version
Docker Environment
Anything else?
No response