Any one know how to install Ghost CMS latest correctly on Cyberpanel Docker Container?


I was trying to install ghost on Docker container using Cyberpanel Docker manager as per the below web guide.

However I’m getting below error log

[90mError: connect ECONNREFUSED
at /var/lib/ghost/versions/5.22.11/node_modules/knex-migrator/lib/database.js:57:19
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)e[39m
[2022-11-18 07:08:27] e[35mWARNe[39m Ghost is shutting down
[2022-11-18 07:08:27] e[35mWARNe[39m Ghost has shut down
[2022-11-18 07:08:27] e[35mWARNe[39m Your site is now offline
[2022-11-18 07:08:27] e[35mWARNe[39m Ghost was running for a few seconds

Does anyone knows how to fix this and install Ghost CMS correct way?

Appreciate your support. Thank you.

Welcome @dinushalr Happy you are here

As you can see knexjs is trying to connect to your MariaDB with no success.

First of all you pull the unofficial image Docker Hub as instructed in the tutorial you tagged

To run Ghost for production you’ll also need to be running with MySQL 8 ( Required in production) https, and a reverse proxy configured with appropriate X-Forwarded-For , X-Forwared-Host , and X-Forwarded-Proto (https ) headers. Configuration - Adapt your publication to suit your needs

Hello @josephgodwinke Thank you so much for reply and support on this, much apricated.

So I need to installed Mysql 8 instead of Mariadb right?

No what i meant is your configure yout database correctly Configuration - Adapt your publication to suit your needs use your container settings - ENV variables

      database__client: mysql
      database__connection__host: db
      database__connection__user: root
      database__connection__password: mysqulrootp@ssworD
      database__connection__database: yourdomain_prodction

I’ve added the ENV variables like below and still getting the same error? my Mariadb hostname showing as localhost and i’ve put that into host field. is that correct? Please help.

Ideally yes localhost should work. Can you change the mysql port and try again

i was trying to change mysql port by editing /etc/my.cnf file, but as you can see file is empty :no_mouth:
Screenshot 2022-11-18 184306

I also tried to edit the mariadb-server.cnf file under /etc/my.cnf.d , there also cannot see any Port defined in it. Please check below screenshot.

Screenshot 2022-11-18 184708

Anywhere else should i check?

Where did you get the root password?

what do you mean? for the server or MariaDB?

Where did you get mysql password that you have put here?

connected to MariaDB via SSH and set a password for root user. there was no password when i first connect to mysql, so i thought that was an issue, so i set a password using below command.

Screenshot 2022-11-18 202014

using this command

ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘passwordused’;
flush privileges;

Sorry buddy i was busy.

Run the command nano /usr/local/CyberCP/CyberCP/ and CTRL+W DATABASES =

copy the root password

    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'cyberpanel',
        'USER': 'cyberpanel',
        'HOST': 'localhost',
    'rootdb': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'mysql',
        'USER': 'root',
        'HOST': 'localhost',
        'PORT': '',

Hold up you wunt be able to connect your local mysql with a docker instance. Saying this from experience but you can try.

Since Ghost instance does not come with mariadb as seen here GitHub - docker-library/ghost: Docker Official Image packaging for Ghost

Can you pull an image of mysql8 and set it up. Use that to connect your ghost blog instance

Make sure you add your ports to your firewalls.

Hi Jose,

first thank you so much for helping me this far, really appreciated that.

As you mentioned earlier i got the root password but no luck, again the same error :no_mouth: .

You mean pull mysql8 image to a separate container and try to connect that to ghost container?

Please let me know, and thank you again for supporting on this.

Yes Docker Hub

ok i will try that out and let you know if i got stuck somewhere. Thank you Jose.