[SOLVED] MySQL unreachable from cms-web_1 docker container

CMS Version

xibo-docker-2.3.3

Installation Method

Docker compose - https://xibo.org.uk/docs/setup/xibo-for-docker-on-linux

Operating System

Red Hat Enterprise Linux release 8.2 (Ootpa) - Fresh install

Issue

After running through the install guide above, connecting to the webserver gives the following:

“Fatal Error - sorry this shouldn’t happen. SQLSTATE[HY000] [2002] Host is unreachable”

docker-compose logs show:
cms-db_1 | 2020-05-12 17:41:06 1 [Note] mysqld: ready for connections.
cms-db_1 | Version: ‘5.6.48’ socket: ‘/var/run/mysqld/mysqld.sock’ port: 3306 MySQL Community Server (GPL)
cms-web_1 | Configuring Database Settings
cms-web_1 | ERROR 2002 (HY000): Can’t connect to MySQL server on ‘mysql’ (115)

I can go into the mysql container and log into the database using the cms user and password set in config.env.

I’ve tried the following:

  • Adding docker0 interface to trusted zone in firewalld.
  • Setting selinux to permissive, though I saw no issues in journalctl, thought I’d try it just in case.
  • tried adding:
    ports:
    • “3306:3306”
      to the cms-db config.
  • deleting directory and reinstalling
  • a few other google result suggestions that I probably have forgotten over the last few days

I’m pretty new to docker so I’m not sure where to go from here. I’ve found several similar issues out there but can’t land on anything that gets around this error. I feel like it is going to be a firewalld issue but I’m not sure what to try next. Any help or thoughts on this are appreciated.

So adding the docker0 interface to the trusted zone in firewalld was half the solution, I also had to add the bridge adapter to trusted.

firewall-cmd --permanent --zone=trusted --add-interface=br-87007905fdb0 (this name may vary)
firewall-cmd --permanent --zone=trusted --add-interface=docker0
firewall-cmd --reload

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.