I saw a lot of similar problem but not exactly like mine... I have a classic architecture,
A server with docker, a stack with Traefik to dispatch request, and few stack of nginx/apache and php. Let's say
The problem is that I can't cURL another website from inside a docker container.
If I try to curl from server itself
curl -v website2.com
curl -v https://website2.com
I get a valid response
If I try to curl from website1 container
curl -v website2.com
curl -v https://website2.com
I can see
Trying XX.XX.XX.XX:443...
With my external IP (so the DNS should be OK) but I don't get any response so it end with a timeout message.
If I add 192.168.48.4 website2.com
into my /etc/hosts
and I try to cURL, I get a valid response but tell me if I'm wrong but in this case it access through local and not from outside of the server
By the way, I need to cURL from a "manager" website that get all domains from an API, so cURL should be dynamic and I can't really add all IP manually into a hosts file or whatever
I really want to access other containers from outside, like an external service
Do you have any suggestion? Thank you guys
Thanks for comment and specifically to this topic https://community.traefik.io/t/curl-from-container-a-to-b-blocked/1040/14
In my case, the firewall (ufw) of my host was "blocking" my http/https requests, even if my domains were accessible
Thoses commands fix my problem
sudo ufw allow http
sudo ufw allow https
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.