Hello Rex @rreyes ,
I couldn’t replicate this inside the docker FPM container on my Linux machine, but was able to replicate that cURL issue inside the docker FPM container on my Windows machine (which seems to be the DNS resolver issue in there).
This what I got when I tested on my Windows machine:
C:\Users\iagus>docker exec -it devkinsta_fpm bash
root@b2953a82ac4c:/www/kinsta# curl -I https://mesilinka-video.s3-us-west-2.amazonaws.com/MF001_E001-1920-00001.jpg
curl: (6) Could not resolve host: mesilinka-video.s3-us-west-2.amazonaws.com
I then tried to add that that external hostname with the following (as I mentioned in my previous reply - step 3 above):
dns_server update -d mesilinka-video.s3-us-west-2.amazonaws.com
but still that didn’t resolve that external hostname via cURL:
root@b2953a82ac4c:/www/kinsta# dns_server update -d mesilinka-video.s3-us-west-2.amazonaws.com
{"domain":"mesilinka-video.s3-us-west-2.amazonaws.com.","records":[{"ttl":60,"class":"IN","type":"A","address":""}]}
root@b2953a82ac4c:/www/kinsta# curl -I https://mesilinka-video.s3-us-west-2.amazonaws.com/MF001_E001-1920-00001.jpg
curl: (6) Could not resolve host: mesilinka-video.s3-us-west-2.amazonaws.com
Then I checked further on my Linux machine (same network/ISP as my Windows machine), and I could see the hostname: mesilinka-video.s3-us-west-2.amazonaws.com
resolves to multiple A records/IP addresses, and the results might change/vary from different locations (and from your location as well):
$ host mesilinka-video.s3-us-west-2.amazonaws.com
mesilinka-video.s3-us-west-2.amazonaws.com is an alias for s3-r-w.us-west-2.amazonaws.com.
s3-r-w.us-west-2.amazonaws.com has address 3.5.80.14
s3-r-w.us-west-2.amazonaws.com has address 3.5.81.171
s3-r-w.us-west-2.amazonaws.com has address 52.218.237.185
s3-r-w.us-west-2.amazonaws.com has address 52.218.237.225
s3-r-w.us-west-2.amazonaws.com has address 52.92.192.114
s3-r-w.us-west-2.amazonaws.com has address 52.92.147.34
s3-r-w.us-west-2.amazonaws.com has address 52.218.241.65
s3-r-w.us-west-2.amazonaws.com has address 52.218.221.49
You can also check the same with this 3rd party tool:
So I altered the command a bit to be something like this on my Windows / local docker FPM container (I added the first 3 IPs showed on my Linux terminal above):
dns_server add -d mesilinka-video.s3-us-west-2.amazonaws.com -A the.ip.address.listed.above
root@b2953a82ac4c:/www/kinsta# dns_server add -d mesilinka-video.s3-us-west-2.amazonaws.com -A 3.5.80.14
{"domain":"mesilinka-video.s3-us-west-2.amazonaws.com.","records":[{"ttl":60,"class":"IN","type":"A","address":"3.5.80.14"},{"ttl":60,"class":"IN","type":"A","address":""}]}
root@b2953a82ac4c:/www/kinsta# dns_server add -d mesilinka-video.s3-us-west-2.amazonaws.com -A 3.5.81.171
{"domain":"mesilinka-video.s3-us-west-2.amazonaws.com.","records":[{"ttl":60,"class":"IN","type":"A","address":"3.5.81.171"},{"ttl":60,"class":"IN","type":"A","address":"3.5.80.14"},{"ttl":60,"class":"IN","type":"A","address":""}]}
root@b2953a82ac4c:/www/kinsta# dns_server add -d mesilinka-video.s3-us-west-2.amazonaws.com -A 52.218.237.185
{"domain":"mesilinka-video.s3-us-west-2.amazonaws.com.","records":[{"ttl":60,"class":"IN","type":"A","address":"52.218.237.185"},{"ttl":60,"class":"IN","type":"A","address":"3.5.81.171"},{"ttl":60,"class":"IN","type":"A","address":"3.5.80.14"},{"ttl":60,"class":"IN","type":"A","address":""}]}
After that, I was able to perform the cURL command line to access that image URL (external host) inside the docker FPM container on my Windows machine:
root@b2953a82ac4c:/www/kinsta# curl -I https://mesilinka-video.s3-us-west-2.amazonaws.com/MF001_E001-1920-00001.jpg
HTTP/1.1 200 OK
x-amz-id-2: 4romAENZjlpN+NUibPf1pLY4NnD79axdqmxLzUPHNJRc287PS0HQ5Ni8CTaRVMyVmmhcUUSOSfI=
x-amz-request-id: ZR4CCCC3XES0NFAG
Date: Fri, 09 Dec 2022 03:49:17 GMT
Last-Modified: Thu, 27 Oct 2022 16:41:03 GMT
ETag: "a0760718792e9085e132d07a57760296"
Accept-Ranges: bytes
Content-Type: image/jpeg
Server: AmazonS3
Content-Length: 51453
I suspect you might be using Windows as well? if that so, please try the steps I mentioned above and see if it will help to resolve that external host name on your local docker FPM container . Once the cURL can resolve that URL/hostname, then you should be able to access the same URL from your PHP scripts.
Cheers,
Agus