Reputation: 1788
The Docker compose file to create a MariaDB container is shown below:
version: '2'
services:
mariadb:
container_name: mytest
image: 'mariadb:X.X.X'
restart: always
ports:
- '3306:3306'
environment:
- MYSQL_ROOT_PASSWORD=root
My question is why we are using '-' for 'ports' and 'environment'. Is this only for readability purpose or it has some other importance also?
Upvotes: 0
Views: 165
Reputation: 2614
Because both ports and environment are YAML collections, since you can have multiple port mappings and environment variables.
Check YAML - Collections.
Upvotes: 0