Docker Community Forums

Share and learn in the Docker community.

Docker-compose not running if mysql service has another name


(Secomax) #1

Hi,

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.


(Secomax) #2

Any idea why renaming the mysql service to any name make it not working while renaming the wordpress service doesn’t matter at all.