The original post: /r/selfhosted by /u/aaronryder773 on 2024-04-30 09:08:30.

Hi,

I was wondering is it a good idea to use only 1 docker container of mariadb for all my services?

I use few applications in docker like firefly3, gitea, etc. and I realized I am creating 2 containers for each application. One application container and another one mariadb / mysql container. I think it’s waste of resources. I understand I might require some tinkering.

I was thinking if this will work or not and what I need to be aware of to make this. I got an idea but don’t know if it’s dumb or if it will even work. I was wondering if am creating a network for each application I will just add all of those in my mysql docker compose

Something like this:

version: '3.8'

services:
  mariadb:
    image: mariadb:latest
    container_name: MariaDB-ALL
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=root
    networks:
      - gitea
      - firefly
    volumes:
      - ./mysql:/var/lib/mysql

networks:
  gitea:
    external: true
  firefly:
    external: true

I am not sure how the config look will like in the applications docker compose yet.