docker wordpress 提示:Error establishing a database connection

  • 时间:
  • 浏览:
  • 来源:互联网

从docker PUll的WordPress 和 mariadb

启动后,提示Error establishing a database connection,网上查找原因,放到基本配置,但没有解决,查看日志有以后错误:

 mysqli::__construct(): (HY000/2002): No route to host in Standard input code on line 22

MySQL Connection Error: (2002) No route to host

MySQL Connection Error: (2002) No route to host

MySQL Connection Error: (2002) No route to host

MySQL Connection Error: (2002) No route to host

MySQL Connection Error: (2002) No route to host

MySQL Connection Error: (2002) No route to host

MySQL Connection Error: (2002) No route to host

MySQL Connection Error: (2002) No route to host

MySQL Connection Error: (2002) No route to host

MySQL Connection Error: (2002) No route to host

WARNING: unable to establish a database connection to '*******'
  continuing anyways (which might have unexpected results)

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message

试着解决AH00558错误 ,无果,又解决2002错误 ,搞定。

nmcli connection modify docker0 connection.zone trusted

systemctl stop NetworkManager.service

firewall-cmd --permanent --zone=trusted --change-interface=docker0

systemctl start NetworkManager.service

nmcli connection modify docker0 connection.zone trusted

systemctl restart docker.service

本文链接http://element-ui.cn/article/show-298658.aspx