August 2018
Intermediate to advanced
372 pages
9h 29m
English
Using the depends_on option, you can specify the order in which the service should start. One service can have dependencies on more than one service, if that's needed.
Let's review the following docker-compose.yaml file, which uses both of these options:
version: '3.1'services: database: image: mysql:5 ports: - "3306:3306" volumes: # Use this option to persist the MySQL data in a shared volume. - db-data:/host/absolute/path/.mysql environment: - MYSQL_ROOT_PASSWORD=example - MYSQL_DATABASE=demo application: image: enriquezrene/docker-compose-banking-app:1.0 ports: - "8081:8080" depends_on: - database environment: - spring.datasource.url=jdbc:mysql://database:3306/demo - spring.datasource.password=example links: - database
Read now
Unlock full access