We have got response from our team and they have conveyed more info regarding this. If that doesn't resolve the issue, please raise a support issue.
1) From the docker compose file we gather below:
a. Matomo is using a docker container to run MySQL database, instead of connecting to a MySQL DB installation on prem or to a MySQL DB on cloud.
b. Hence the docker compose file (File 1) has a “db” container whipped up too (from a mariadb docker image) – as below. Here, the “volume” is just where the containerized MySQL DB’s data persists.
5. db:
6. image: mariadb
7. command: --max-allowed-packet=64MB
8. restart: always
9. volumes:
10. - ./db:/var/lib/mysql
11. environment:
12. - MYSQL_ROOT_PASSWORD=XXXX
13. env_file:
14. - ./db.env
15. ports:
16. - 3306:3306
c. The app then connects to this db : as specified in “environment” – as below.
24. environment:
25. - MATOMO_DATABASE_HOST=db
26. env_file:
27. - ./db.env
28. ports:
29. - 8080:80
2) Now, if Cx wants to connect to Azure DB for MySQL instead of this local MySQL DB Container instance,
a. We do not need a MySQL DB container at all, hence won’t need to whip the container from a docker image, and in turn won’t need a docker compose at all (docker compose is for multi-container scenario.)
b. Instead, what you can do is pass “MATOMO_DATABASE_HOST=mysqldemosvr.mysql.database.azure.com” env variable while running the docker using docker run itself.
Of course, instead of directly specifying the credentials this way, you can store all credentials like MATOMO_DATABASE_HOST, MATOMO_DATABASE_PORT, MATOMO_DATABASE_USERNAME, MATOMO_DATABASE_PASSWORD, in an .env file and “docker run” by passing this file.
c. Cx can refer to : How to run Matomo in a Docker container while passing database credentials as environment variables - DEV Community. And plug in their Azure DB for MySQL credentials.