I’m having trouble getting the [Wordpress ‘getting started’ exercise] (http://docs.rancher.com/rancher/v1.1/en/quick-start-guide/) working with our fresh Rancher cluster.
My Wordpress containers are unable to connect to the MySQL instance named ‘mysql’, and that seems to be due to a DNS error:
[root@docker1 ~]# # docker logs --tail 10 r-StefanWordpress2_mywordpress_1
Warning: mysqli::mysqli(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 19
MySQL Connection Error: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
Upon further inspection, I noticed that /etc/resolv.conf lists our corporate domainname as the first entry in /etc/resolv.conf
:
[root@docker1 ~]# docker exec -it r-StefanWordpress2_mywordpress_1 cat /etc/resolv.conf
search example.org stefanwordpress2.rancher.internal mywordpress.stefanwordpress2.rancher.internal rancher.internal
nameserver 169.254.169.250
[root@docker1 ~]#
If I understand right, this means that my wordpress_1 container will attempt to connect to mysql.example.org first
. But shouldn’t it really be connecting to mysql.stefanwordpress2.rancher.internal
? Why is our corporate domain name listed as the first search domain in /etc/resolv.conf
?