Docker Container won't connect to Database

Hello,

I’m trying to install n8n.io and invoiceninja in a docker containers inside of CyberPanel. I’ve add the .env variables to both containers but I can’t seem the get them to connect to the databases that I’ve created for them. I keep getting the following error:

There was an error initializing DB: “connect ECONNREFUSED 172.17.0.1:3306”

I’ve tried 127.0.0.1 and localhost; nothing works. Is anyone able to help me get this up and running?

Welcome @VanLuda Happy you are here

Use 0.0.0.0 to connect and the external ports only.

Unfortunately that didn’t work either. Received the following error:

There was an error initializing DB: “connect ECONNREFUSED 0.0.0.0:3306”

You are not using external ports. 3306 is an internal port.

I’m confused because 0.0.0.0 is an internal ip address, wouldn’t you want to use an internal port?

You will have to recreate the container and set the port to a “proxy” port say 4123 if its not used

8ea2b03d9b76f5484efffb20d5c6496a4c6870ef_2_356x500

Yeah, I did that I have port 5678 for n8n and port 9000 for invoiceninja.

I have just checked out invoice ninja documenation on docker. It is my honest opinion that such an installation will not work the cyberpanel way.

Can you try and install it through terminal and reverse proxy to cyberpanel. Meaning you will not manage this container on cyberpanel docker manager.

I’ve created the reverse proxy and generated the api key via the cli. I can’t figure out this database connection thing with either installation. It’s driving me nuts. I’ve thrown everything I can think of at it. I thought maybe the firewall is preventing access from the container to 3306 but the firewall is currently turned off.

Sadly, If it fails then it has failed! I have done this for several clients with no success. Docker images that depend on other images or need special tinkering never work from my experience.

You can install it this way Install Invoice Ninja v5 on Ubuntu 20.04 - Self-Hosted | v5 - Discourse if you are running ubuntu

  1. Create a website with CyberPanel.

  2. Ignore Install Invoice Ninja v5 on Ubuntu 20.04 - Self-Hosted | v5 - Discourse use this instead [TUTORIAL] How to install any PHP modules using PEAR Package Manager OR use the https://SERVER_URL/managephp/installExtensions

  3. Ignore everything else but not this Install Invoice Ninja v5 on Ubuntu 20.04 - Self-Hosted | v5 - Discourse

  $ cd /home/mywebsite.com/public_html/
  # www.mywebsite.com/invoiceninja
  $ sudo mkdir invoiceninja && cd invoiceninja
  $ sudo wget <latest zip url>
  $ sudo unzip invoiceninja.zip
  1. Install Invoice Ninja v5 on Ubuntu 20.04 - Self-Hosted | v5 - Discourse

  2. For this step Install Invoice Ninja v5 on Ubuntu 20.04 - Self-Hosted | v5 - Discourse just go to Websites → List Websites → mywebsite.com → FIle Manager → Fix Permissions

  3. For this step Install Invoice Ninja v5 on Ubuntu 20.04 - Self-Hosted | v5 - Discourse create a cronjob the cyberpanel way - 7 - Cron Jobs - Docs - CyberPanel Community

Same applies for Install Invoice Ninja v5 on Enterprise Linux 8 - Self-Hosted | v5 - Discourse