Docker, PHP and stream_socket_client: connection timeout - Stack Overflow
I built a PHP application to establish a TCP socket connection to a mail server (SMTP server) on port 25, using a proxy. Here the main part:
$context = [
"http" => [
"proxy" => "tcp://xx.xx.xx.xx:xxxx",
"request_fulluri" => true
"header" => "Proxy-Authorization: Basic xxxxxxxxxxx"
]]
};
$connection = @stream_socket_client(
address: "tcp://$mxHost:25",
error_code: $errno,
error_message: $errstr,
timeout: 10,
context: $context
);
I built the first version of the app as a Vanilla PHP with some Symfony components, and I run it using php -S localhost:8000 -t .
and it works like a charm.
Then I decided to install Symfony, inside a Docker installation. Since I build a DDD/Clean Architecture application, it was easy to switch to a fully Symfony application.
But then the problems start.
It seems like inside Docker I cannot use stream_socket_client
correctly, I always get a connection timeout (110).
At some point I added
dns: # Custom DNS settings
- 8.8.8.8
- 1.1.1.1
to my docker-compose.yml, and it worked for one day. The day after, it stopped to works and I started again to get connection timeout.
My knowledge about network is not so strong, so I need a help.
Can someone give me a tip, a suggestion, an idea to unblock this situation?
- 虚拟现实技术2015年将迎来爆发
- 苹果WWDC2014:iOS 8新功能都有哪些?
- 微信支付和支付宝口水战开打!
- [连载]巨头“心血之作”终失败(一):苹果Apple TV
- 常受电脑辐射的白领男易生闺女?
- How to efficiently read HDF5 file using NetCDF-java - Stack Overflow
- python - Chromadb: Why do results of collection.query() and collection.get() differ? - Stack Overflow
- soa - How to use a variable in a composite or wsdl, as I need to have this variable per environment? - Stack Overflow
- How to Interact with iframe in Google Form “add file” feature Using Python and Playwright? - Stack Overflow
- javascript - In Quill, how to add one button to the toolbar to add some text? - Stack Overflow
- c# - Is there a way to fill scriptable object field with a child class? - Stack Overflow
- solrj - How to enable using a magic field with eDisMax in Solr 9.4? - Stack Overflow
- python - calculate the absorption coefficient of the particles using pymiescatt - Stack Overflow
- windows - Significant 600 ms lag between TwinCAT 3 and Simulink using TCSymbol interface (TE1410). How can I reduce this latency
- javascript - Why does the iterator close after a break in a for...of loop? - Stack Overflow
- python - overrideredirect() no longer working on MAC? - Stack Overflow
- amazon web services - AWS Workload Identity - Stack Overflow