Hi everyone, I am trying to deploy Ghost 5 via docker on my Synology NAS. The problem I am running into is that I keep getting an error that prevents Ghost from communicating with MySQL.
[2022-12-29 12:24:45] INFO Ghost is running in production...
[2022-12-29 12:24:45] INFO Your site is now available on http://localhost:2368/
[2022-12-29 12:24:45] INFO Ctrl+C to shut down
[2022-12-29 12:24:45] INFO Ghost server started in 21.608s
[2022-12-29 12:24:50] ERROR connect ECONNREFUSED 172.31.0.2:3306
connect ECONNREFUSED 172.31.0.2:3306
"Unknown database error"
Error ID:
500
Error Code:
ECONNREFUSED
----------------------------------------
Error: connect ECONNREFUSED 172.31.0.2:3306
at /var/lib/ghost/versions/5.26.3/node_modules/knex-migrator/lib/database.js:57:19
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
[2022-12-29 12:24:50] WARN Ghost is shutting down
[2022-12-29 12:24:50] WARN Ghost has shut down
[2022-12-29 12:24:50] WARN Your site is now offline
[2022-12-29 12:24:50] WARN Ghost was running for a few seconds
My docker-compose
looks like this
version: "3.7"
services:
ghost:
container_name: ghost
image: ghost:latest
volumes:
- ./ghost/content:/var/lib/ghost/content
environment:
- database__client=mysql
- database__connection__host=mysql
- database__connection__user=root
- database__connection__password=${MYSQL_PSW}
- database__connection__database=${MYSQL_DB}
ports:
- 2368:2368
depends_on:
- mysql
restart: unless-stopped
mysql:
container_name: ghost-laughandgrowfat-db
image: 'mysql:latest'
volumes:
- ./mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_PSW}
restart: unless-stopped
I honestly don’t know what to do anymore, I tried so many things and yet I can’t manage to deploy succesfully.
Any help is appreciated