Stuck on Waiting for MySQL to Start - Docker Install on VPS with Remote DB


#1

Hello,

Background:

I’m looking to install Xibo via docker on our CentOS VPS with a remote DB so we can easily query data from the Xibo DB and join data with our web application DB for integration and reporting purposes. The regular docker installation (with the integrated db container) works great, but I run into issues when bringing up the containers for a remote-db configuration.

Issue:

Starting with a clean docker environment, i.e., no other containers, when I attempt to bring up containers for a remote-db configuration, the process times out waiting for MySQL to start. Below is the message I get with IP masked out.

ERROR 2003 (HY000): Can’t connect to MySQL server on ‘xxx.xxx.xxx.xxx’ (110 “Operation timed out”)

I am confident the “MYSQL_” variables are set properly in my remote-config.env, because I can connect to the mysql db from other machines using the same info. The database does exist and is empty with the proper user permissions set up, etc.

I’m wondering if there is a network-related issue whereby the cms-web container is not able to route to my db. Perhaps I have a mis-configuration somewhere? I’ve tried changing the bind-address in the my.cnf file to 0.0.0.0 and I tried commenting it out. The result is the same.

My remote-docker-compose.yml seems pretty straightforward and is shown below. The only difference is I’m mapping to port 8080 for the web container.

Any assistance is greatly appreciated. Thanks in advance!

Update 2-6-2019:
I was tinkering with the remote-docker.yml file and added network_mode: host to each container. While this caused the web server to bomb (as expected), it did find and properly provision the external MySQL db which further indicates a networking/communication issue between the cms-web container and my db.

version: "2.1"

services:
    cms-xmr:
        image: xibosignage/xibo-xmr:release-0.7
        ports:
            - "9505:9505"
        restart: always
        env_file: remote-config.env
        mem_limit: 256m
    cms-web:
        image: xibosignage/xibo-cms:release-1.8.12
        volumes:
            - "./shared/cms/custom:/var/www/cms/custom"
            - "./shared/backup:/var/www/backup"
            - "./shared/cms/web/theme/custom:/var/www/cms/web/theme/custom"
            - "./shared/cms/library:/var/www/cms/library"
            - "./shared/cms/web/userscripts:/var/www/cms/web/userscripts"
        restart: always
        links:
            - cms-xmr:50001
        environment:
            - XMR_HOST=cms-xmr
        ports:
            - "8080:80"
        env_file: remote-config.env
        mem_limit: 1g

#2

So the container will need to route to your database server.

I’d guess a firewall rule is blocking access somewhere, as it works when the host connects but not the container - so I’d guess something is matching on source IP (and isn’t allowing the containers IP through)


#3

Thanks for the response Alex. After tinkering with the firewall to no avail, I opted to use the full docker configuration. I was able to add my application db to the docker container and the two databases can be queried together.