Help setting up Ghost with MariaDB on Docker

Hi, I am trying to create a Ghost container and make it connect to an already existing MariaDB container (which already holds a whole load of databases for other services I am self-hosting).

So far I am mostly just failing, so I’m hoping I can get some help. This is my docker-compose:

ghost-blog:
    container_name: ghost-blog
    image: ghost:latest
    volumes:
      - /volume1/docker/ghost-blog:/var/lib/ghost/content
    environment:
      - url=${BLOG_URL}
      - TZ=${TZ}
      - database__client=mysql
      - database__connection__host=mariadb
      - database__connection__user=${BLOG_USER}
      - database__connection__password=${BLOG_PSW}
      - database__connection__database=${BLOG_DB}
    ports:
      - 2369:2368
    depends_on:
      - mariadb
    restart: unless-stopped

mariadb:
    container_name: mariadb
    image: linuxserver/mariadb:latest
    volumes:
      - /volume1/docker/mariadb:/config
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=${MARIADB_ROOTPSW}
      - TZ=${TZ}
    ports: 
      - 3306:3306
    restart: unless-stopped

The error I get is

Invalid database host
Error: getaddrinfo ENOTFOUND mariadb

Can anyone give me any pointer on how to move forward?

Thank you!

Have you tried using this Docker container for Ghost? Here’s a direct link:
https://hub.docker.com/_/ghost

That is, in fact, the image I am using. The issue here is that the guide makes a separate db container just for Ghost, while I am trying to connect Ghost to an existing MariaDB where my db would end up being located).