How Environment works in docker

Hi, I am new to docker in general and I have a question regarding environment in docker-compose.

I have a mariadb image and a java image that has my application.

when setting the environment for mariadb I use

environment:
  - MARIADB_ROOT_PASSWORD=foo

and when setting the database connection for my spring app

environment:
   spring.datasource.url: "jdbc:mariadb://bar:3306"

My question is why for mariadb I use ’ - ’ and ’ = ', and for spring I do not use ’ - ’ and ’ = '.

I tried setting the spring environment the same way I did in mariadb and it did not work

I closed this topic, as you already created an identical topic:

1 Like