I recommend this service:
mariadb: image: mariadb:latest environment: - MYSQL_DATABASE=servicename - MYSQL_USER=servicename - MYSQL_PASSWORD=${MARIADB_PASSWORD} - MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD} volumes: - ./mariadb_data:/var/lib/mysql command: --default-storage-engine innodb restart: unless-stopped healthcheck: test: mysqladmin -p${MARIADB_ROOT_PASSWORD} ping -h localhost interval: 20s start_period: 10s timeout: 10s retries: 3
(replace servicename
by the name of your service, e.g. kimai
, redmine
, …) and this .env
:
MARIADB_ROOT_PASSWORD=eiNgam3woh4ahTee4chi9vohvauk6a MARIADB_PASSWORD=shahb4alubei5Vie8arahhok2morae
You can also easily generate these passwords by using:
echo -e "MARIADB_ROOT_PASSWORD=$(pwgen 30 1)\nMARIADB_PASSWORD=$(pwgen 30 1)" > .env