MariaDB image does not pick up port env variable



I want to run two mariaDBs for my build. To avoid port collision I will need to specify different ports for the two databases.

So I set up my build with following configuration:

    working_directory: ~/my-service-dir
    - image: circleci/mariadb:10.2
        MYSQL_TCP_PORT: 3306
        MYSQL_DATABASE: firstDB
        MYSQL_USER: firstUser
        MYSQL_PASSWORD: pass
    - image: circleci/mariadb:10.2
        MYSQL_TCP_PORT: 3307
        MYSQL_DATABASE: secondDB
        MYSQL_USER: secondUser
        MYSQL_PASSWORD: pass

I would expect one DB to start on port 3306 and other on port 3307.
What happens is that one of the DBs starts on port 3306 as expected but the other tries to start on the port 3306 as well.
It results in this error:

2019-01-10 21:42:17 140173269059456 [ERROR] Can’t start server: Bind on TCP/IP port. Got error: 98: Address already in use
2019-01-10 21:42:17 140173269059456 [ERROR] Do you already have another mysqld server running on port: 3306 ?

If I switch from MariaDB to mysql then the configuration is picked up correctly. (MariaDB and MySQL use the same configurations so the env variables should work the same).

I did another test with MariaDB by setting the firstDB to port 3307 and second one to port 3308. They both decided to try and start on port 3306. So I guess the variable is just ignored and thus they always reset to default port?