I just tried the following file to run WordPress with MariaDB
version: '3.1' services: wordpress: image: wordpress ports: - 80:80 environment: WORDPRESS_DB_PASSWORD: 123 mysql: image: mariadb:10.3 environment: MYSQL_ROOT_PASSWORD: 123
If I change the MySQL service name to anything other than mysql, it cannot connect to MySQL!!
Unlike WordPress service, if I change it, it still works.