Separate environment variables for multiple services with same image

So, I’m trying to use two instances of the same image, more specifically the mysql service but I can’t figure out, how to use different environment variables for each of the service instances:

services:
  - name: mysql:8.0.32
    alias: maindb
  - name: mysql:8.0.32
    alias: otherdb

variables:
  # Configure mysql environment variables (https://hub.docker.com/_/mysql/)
  MYSQL_DATABASE: $DB_DATABASE
  MYSQL_ROOT_HOST: "%"
  MYSQL_ROOT_PASSWORD: $DB_PASSWORD
  MYSQL_USER: $DB_USERNAME
  MYSQL_PASSWORD: $DB_PASSWORD
  MYSQL_HOST: $DB_HOST
  MYSQL_PORT: $DB_PORT

According to the docs, it is possible to specify variables directly for the service, so I thought, I just need to do this:

services:
  - name: mysql:8.0.32
    alias: maindb
    variables:
      # Configure mysql environment variables (https://hub.docker.com/_/mysql/)
      MYSQL_DATABASE: $DB_DATABASE
      MYSQL_ROOT_HOST: "%"
      MYSQL_ROOT_PASSWORD: $DB_PASSWORD
      MYSQL_USER: $DB_USERNAME
      MYSQL_PASSWORD: $DB_PASSWORD
      MYSQL_HOST: $DB_HOST
      MYSQL_PORT: $DB_PORT
  - name: mysql:8.0.32
    alias: otherdb
    variables:
      # Configure mysql environment variables (https://hub.docker.com/_/mysql/)
      MYSQL_DATABASE: $DB2_DATABASE
      MYSQL_ROOT_HOST: "%"
      MYSQL_ROOT_PASSWORD: $DB2_PASSWORD
      MYSQL_USER: $DB2_USERNAME
      MYSQL_PASSWORD: $DB2_PASSWORD
      MYSQL_HOST: $DB2_HOST
      MYSQL_PORT: $DB2_PORT

but it warns you that

:information_source: Variables set in the GitLab UI are not passed down to the service containers. For more information, see GitLab CI/CD variables.

So, maybe that explains this:

*** WARNING: Service runner-[...]-mysql-0 probably didn't start properly.
Health check error:
start service container: Error response from daemon: Cannot link to a non running container: /runner-[...]-mysql-0 AS /runner-[...]-mysql-0-wait-for-service/service (services.go:187:0s)
Service container logs:
2023-11-09T10:03:01.238208088Z 2023-11-09 10:03:01+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.32-1.el8 started.
2023-11-09T10:03:01.390086193Z 2023-11-09 10:03:01+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2023-11-09T10:03:01.399340015Z 2023-11-09 10:03:01+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.32-1.el8 started.
2023-11-09T10:03:01.542018145Z 2023-11-09 10:03:01+00:00 [ERROR] [Entrypoint]: Database is uninitialized and password option is not specified
2023-11-09T10:03:01.542054237Z You need to specify one of the following as an environment variable: 2023-11-09T10:03:01.542058782Z - MYSQL_ROOT_PASSWORD 2023-11-09T10:03:01.542062323Z - MYSQL_ALLOW_EMPTY_PASSWORD 2023-11-09T10:03:01.542065140Z - MYSQL_RANDOM_ROOT_PASSWORD

The docs are not clear on this or am I missing something?