Open iuriguilherme opened 1 month ago
I think docker-compose support loading environment variables from a .env
file and then use them in your docker-compose:
https://stackoverflow.com/questions/29377853/how-can-i-use-environment-variables-in-docker-compose
# .env file
MARIADB_USER: user
version: "2"
services:
mariadb:
...
environment:
MARIADB_USER: ${MARIADB_USER}
...
mysql-cron-backup:
...
environment:
MYSQL_USER: ${MARIADB_USER}
latest mariadb uses environment variables like MARIADB_USER MARIADB_PASSWORD MARIADB_DATABASE instead of the MYSQL prefix.
Docker compose doesn't override multiple env files when using the form MYSQL_USER: ${MARIADB_USER}
So I have to update the same value twice when sharing the env_file with the mariadb container: