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
也可以使用下面的命令:
firewall-cmd —permanent —zone=public —add-rich-rule=‘rule family=ipv4 source address=172.17.0.0/16 accept’ && firewall-cmd —reload
firewall-cmd —zone=trusted —change-interface=docker0 —permanent
firewall-cmd —zone=trusted —change-interface=brxxxxx —permanent
firewall-cmd —zone=trusted —change-interface=bryyyyy —permanent
还没有评论,来说两句吧...