WordPress installation: unable to reach WordPress.org
I've installed a WordPress website using Docker container in my Linode server. I have another 2 Docker WordPress containers running WordPress on this server.
Since yesterday my WordPress application can't list WordPress plugins on the plugin page. So I installed manually a plugin (Health Check) to diagnose the problem. The message related on the plugin is "Unable to reach WordPress.org at 188.8.131.52: cURL error 6: Could not resolve host: wordpress.org".
I tried to run 'curl' on Linux, running curl outside the container and inside it for 'wordpress.org'. The response were the same: the curl responded with a HTML (with 301 moved permanently). The response to the command is correct as this is happening on my desktop computer which runs a WordPress and list WordPress plugins without problems.
I cant't list the plugins (and install form inside the plugins page) but, worse, my payment plugin isn't working because of the same problem:
'WP_Error in generate payment token: cURL error 6: Could not resolve host: (address of the host communicated)'.
What can I do?
To test my internet connection inside the Docker container I had to use the following test because the container doesn't have
echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1 if [ $? -eq 0 ]; then echo "Online" else echo "Offline" fi
The result was Offline.
Outsite the container (on my Linode host) the result was Online. So, besides
curl worked the same way both on the host and on the container, the internet connection test didn't.
I followed this tip, modifying file
/var/www/html/wp-includes/Requests/Transport/cURL.PHP and the plugins are now appearing on the page:
I'm almost certain that my problem is with DNS configuration and this is not the right thing to do (fixing IP addresses on PHP), so I want to resolve it the right way.